package org.commscope.tr069adapter.netconf.notification;\r
\r
import org.commscope.tr069adapter.mapper.model.NetConfNotificationDTO;\r
+import org.commscope.tr069adapter.netconf.server.utils.NetConfServerConstants;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
+import org.slf4j.MDC;\r
import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.jms.core.JmsTemplate;\r
import org.springframework.stereotype.Component;\r
\r
@Component\r
public class NotificationHandler {\r
\r
- private static final Logger LOG = LoggerFactory.getLogger(NotificationHandler.class);\r
+ private static final Logger logger = LoggerFactory.getLogger(NotificationHandler.class);\r
+ private static final String CLIENT_STR = "client";\r
\r
@Autowired\r
NetConfSessionUtil netConfSessionUtil;\r
\r
+ @Autowired\r
+ private JmsTemplate jmsTemplate;\r
+\r
public void handleNetConfNotification(NetConfNotificationDTO netConNotifDTO) {\r
- LOG.debug("processing netconf notification " + netConNotifDTO);\r
- netConfSessionUtil.sendNetConfNotification(netConNotifDTO);\r
- }\r
+ logger.debug("processing netconf notification {}", netConNotifDTO);\r
+ try {\r
+ MDC.put(CLIENT_STR, netConNotifDTO.getDeviceID());\r
\r
+ logger.debug("NetConf notificaiton reviced for {}", netConNotifDTO.getDeviceID());\r
+ jmsTemplate.convertAndSend(NetConfServerConstants.NETCONF_NOTIFICATION_Q, netConNotifDTO);\r
+ logger.debug("Successfully posted the notiticaiton to JMS to forward to SDNR");\r
+ } catch (Exception e) {\r
+ logger.error("Posting notification failed; Reason: {}", e.getMessage());\r
+ } finally {\r
+ MDC.remove(CLIENT_STR);\r
+ }\r
+ }\r
}\r