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;fp=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Fdmaap%2FDmaapMessageConsumer.java;h=6312e375aaccc7bd55a4c1f9c6f0cccb1fd57a4f;hb=0b10c7fa768f05ae5146ce2f3a69998bb8f97a9f;hp=dd60d3947a2845e54a19d90c6422e3aa3861f99c;hpb=05db307945f8069ddc1da51c34681efbeef58be2;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 dd60d394..6312e375 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 @@ -44,10 +44,12 @@ import org.springframework.stereotype.Component; * The class fetches incoming requests from DMAAP. It uses the timeout parameter that lets the MessageRouter keep the * connection with the Kafka open until requests are sent in. * + *

* If there is no DMaaP configuration in the application configuration, then this service will regularly check the * configuration and start polling DMaaP if the configuration is added. If the DMaaP configuration is removed, then the * service will stop polling and resume checking for configuration. * + *

* Each received request is processed by {@link DmaapMessageHandler}. */ @Component @@ -67,8 +69,14 @@ public class DmaapMessageConsumer { this.applicationConfig = applicationConfig; } + /** + * Starts the consumer. If there is a DMaaP configuration, it will start polling for messages. Otherwise it will + * check regularly for the configuration. + * + * @return the running thread, for test purposes. + */ public Thread start() { - Thread thread = new Thread(() -> this.checkConfigLoop()); + Thread thread = new Thread(this::checkConfigLoop); thread.start(); return thread; }