Exception test Fix
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / dmaap / DmaapMessageHandler.java
index 172fe98..61c1e1e 100644 (file)
@@ -45,6 +45,7 @@ public class DmaapMessageHandler {
 
     private static final Logger logger = LoggerFactory.getLogger(DmaapMessageHandler.class);
 
+    private boolean initialize = false;
     @Autowired
     private ObjectMapper mapper;
     @Autowired
@@ -57,8 +58,9 @@ public class DmaapMessageHandler {
     // The publish properties is corrupted. It contains the subscribe property values.
     @Async("threadPoolTaskExecutor")
     public void handleDmaapMsg(String msg) {
-        logger.debug("Message  ---------->{}", msg);
-        init();
+        if (!initialize) {
+            init();
+        }
         DmaapRequestMessage dmaapRequestMessage = null;
         Optional<String> dmaapResponse = null;
         // Process the message
@@ -166,6 +168,7 @@ public class DmaapMessageHandler {
         topic = dmaapPublisherConfig.getProperty("topic");
         logger.debug("Read the topic & Service Name - {} , {}", host, topic);
         this.restClient = new AsyncRestClient("http://" + host + "/"); // get this value from application config
+        initialize = true;
 
     }
 }