X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Fdmaap%2FDmaapMessageHandler.java;h=61c1e1e2993675d40e4ed4c3a955ac80b3ed5381;hb=refs%2Fchanges%2F83%2F2383%2F3;hp=713d483417e878049c3a67958ad6ff61fd96a47f;hpb=eeaabb5364f23818dda5d10e0a7f30396bb981f4;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java index 713d4834..61c1e1e2 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java @@ -45,23 +45,22 @@ public class DmaapMessageHandler { private static final Logger logger = LoggerFactory.getLogger(DmaapMessageHandler.class); + private boolean initialize = false; @Autowired private ObjectMapper mapper; @Autowired private PolicyController policyController; private AsyncRestClient restClient; + @Autowired private ApplicationConfig applicationConfig; private String topic = ""; - @Autowired - public DmaapMessageHandler(ApplicationConfig applicationConfig) { - this.applicationConfig = applicationConfig; - } - // The publish properties is corrupted. It contains the subscribe property values. @Async("threadPoolTaskExecutor") public void handleDmaapMsg(String msg) { - init(); + if (!initialize) { + init(); + } DmaapRequestMessage dmaapRequestMessage = null; Optional dmaapResponse = null; // Process the message @@ -71,7 +70,7 @@ public class DmaapMessageHandler { * "apiVersion": "1.0", "originatorId": "849e6c6b420", "requestId": "23343221", "operation": "getPolicySchemas", * "payload": "{\"ricName\":\"ric1\"}" } * - * -------------------------------------------------------------------------------------------------------------- + * ------------------------------------------------------------------------------------------------------------- * Sample Response Message to DMAAP {type=response, correlationId=c09ac7d1-de62-0016-2000-e63701125557-201, * timestamp=null, originatorId=849e6c6b420, requestId=23343221, status=200 OK, message=[]} * ------------------------------------------------------------------------------------------------------------- @@ -162,17 +161,14 @@ public class DmaapMessageHandler { return Optional.empty(); } - // @PostConstruct - // The application properties value is always NULL for the first time - // Need to fix this public void init() { logger.debug("Reading DMAAP Publisher bus details from Application Config"); Properties dmaapPublisherConfig = applicationConfig.getDmaapPublisherConfig(); String host = (String) dmaapPublisherConfig.get("ServiceName"); topic = dmaapPublisherConfig.getProperty("topic"); - System.out.println("\"Read the topic ---------->" + topic); logger.debug("Read the topic & Service Name - {} , {}", host, topic); this.restClient = new AsyncRestClient("http://" + host + "/"); // get this value from application config + initialize = true; } }