X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Fdmaap%2FDmaapMessageConsumer.java;h=da209a8609888f4c1d07d1aed58e686c1dd24acb;hb=ef3dfbede0a7430e8f7272a599e64d8cea71d017;hp=e72fcf0b253fc9c8b65c2f3f4c17a370b0c2ff82;hpb=dede1d28c8f37bb21fae806f00f8315b923670c1;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumer.java b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumer.java index e72fcf0b..da209a86 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumer.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumer.java @@ -22,7 +22,6 @@ package org.oransc.policyagent.dmaap; import com.google.common.collect.Iterables; -import java.io.FileNotFoundException; import java.io.IOException; import java.time.Duration; import java.util.Properties; @@ -40,12 +39,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +/** + * The class fetches incoming requests from DMAAP on regular intervals. Each + * received request is proceesed by DmaapMessageHandler. + */ @Component public class DmaapMessageConsumer implements Runnable { private static final Logger logger = LoggerFactory.getLogger(DmaapMessageConsumer.class); - private final static Duration TIME_BETWEEN_DMAAP_POLLS = Duration.ofSeconds(10); + private static final Duration TIME_BETWEEN_DMAAP_POLLS = Duration.ofSeconds(10); private final ApplicationConfig applicationConfig; @@ -60,10 +63,6 @@ public class DmaapMessageConsumer implements Runnable { thread.start(); } - DmaapMessageConsumer(ApplicationConfig applicationConfig, boolean start) { - this.applicationConfig = applicationConfig; - } - private boolean isDmaapConfigured() { Properties consumerCfg = applicationConfig.getDmaapConsumerConfig(); Properties producerCfg = applicationConfig.getDmaapPublisherConfig(); @@ -111,7 +110,7 @@ public class DmaapMessageConsumer implements Runnable { } private DmaapMessageHandler getDmaapMessageHandler() throws IOException { - String agentBaseUrl = "http://localhost:" + this.localServerPort; + String agentBaseUrl = "https://localhost:" + this.localServerPort; AsyncRestClient agentClient = createRestClient(agentBaseUrl); Properties dmaapPublisherProperties = applicationConfig.getDmaapPublisherConfig(); MRBatchingPublisher producer = getMessageRouterPublisher(dmaapPublisherProperties); @@ -129,7 +128,7 @@ public class DmaapMessageConsumer implements Runnable { } } - MRConsumer getMessageRouterConsumer(Properties dmaapConsumerProperties) throws FileNotFoundException, IOException { + MRConsumer getMessageRouterConsumer(Properties dmaapConsumerProperties) throws IOException { return MRClientFactory.createConsumer(dmaapConsumerProperties); } @@ -141,8 +140,7 @@ public class DmaapMessageConsumer implements Runnable { return new AsyncRestClient(agentBaseUrl); } - MRBatchingPublisher getMessageRouterPublisher(Properties dmaapPublisherProperties) - throws FileNotFoundException, IOException { + MRBatchingPublisher getMessageRouterPublisher(Properties dmaapPublisherProperties) throws IOException { return MRClientFactory.createBatchingPublisher(dmaapPublisherProperties); } }