diff options
author | 2020-09-22 17:58:44 +0530 | |
---|---|---|
committer | 2020-09-22 19:05:32 +0530 | |
commit | 9170fe0e3aad7a336b0f0d08e63b9de127a9f9de (patch) | |
tree | 26b6e646f23c78aadb3484af0a4f8ab4c7c4d547 /components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap | |
parent | 8882e23eedce9e9236e1d979b2056b62dd974d91 (diff) |
Fix dependency injection issues in sliceanalysisms1.0.0-slice-analysis-ms
Issue-ID: DCAEGEN2-2451
Signed-off-by: dhebeha <dhebeha.mj71@wipro.com>
Change-Id: I557c06f2e817ed8bdfe3b9c0540a19a8ceaaab52
Diffstat (limited to 'components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap')
2 files changed, 12 insertions, 8 deletions
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/DmaapClient.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/DmaapClient.java index 08a89541..6e0f4f27 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/DmaapClient.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/DmaapClient.java @@ -21,8 +21,6 @@ package org.onap.slice.analysis.ms.dmaap; -import com.att.nsa.cambria.client.CambriaConsumer; - import java.util.Map; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @@ -34,8 +32,11 @@ import org.onap.slice.analysis.ms.models.Configuration; import org.onap.slice.analysis.ms.utils.DmaapUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.att.nsa.cambria.client.CambriaConsumer; + /** * This class initializes and starts the dmaap client * to listen on application required dmaap events @@ -47,6 +48,9 @@ public class DmaapClient { private static Logger log = LoggerFactory.getLogger(DmaapClient.class); private DmaapUtils dmaapUtils; + + @Autowired + private IntelligentSlicingCallback intelligentSlicingCallback; /** * init dmaap client. @@ -113,7 +117,7 @@ public class DmaapClient { // create notification consumers for ML MS NotificationConsumer intelligentSlicingConsumer = new NotificationConsumer(intelligentSlicingCambriaConsumer, - new IntelligentSlicingCallback()); + intelligentSlicingCallback); // start intelligent Slicing notification consumer threads executorPool = Executors.newScheduledThreadPool(10); executorPool.scheduleAtFixedRate(intelligentSlicingConsumer, 0, configuration.getPollingInterval(), diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/IntelligentSlicingCallback.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/IntelligentSlicingCallback.java index dd6760ba..b5d79ff3 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/IntelligentSlicingCallback.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/IntelligentSlicingCallback.java @@ -25,8 +25,9 @@ import java.io.IOException; import org.onap.slice.analysis.ms.models.MLOutputModel; import org.onap.slice.analysis.ms.service.MLMessageProcessor; -import org.onap.slice.analysis.ms.utils.BeanUtil; import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @@ -34,14 +35,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; /** * Handles Notification on dmaap for ML ms events */ +@Component public class IntelligentSlicingCallback implements NotificationCallback { private static final Logger log = org.slf4j.LoggerFactory.getLogger(IntelligentSlicingCallback.class); + + @Autowired private MLMessageProcessor mlMsMessageProcessor; - public IntelligentSlicingCallback() { - mlMsMessageProcessor = BeanUtil.getBean(MLMessageProcessor.class); - } - /** * Trigger on Notification from ML ms */ |