diff options
author | 2020-10-13 21:24:08 +0530 | |
---|---|---|
committer | 2020-10-27 13:15:37 +0530 | |
commit | fadaccdb8396a178134ef95982e96ed8a5cddc26 (patch) | |
tree | d81b7d33dbc373d0656f969e24783aba2aaeae33 /components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConsumerThread.java | |
parent | 9170fe0e3aad7a336b0f0d08e63b9de127a9f9de (diff) |
Fix Issues
- Fix certificate issue for authenticated topic
- Fix consumer thread issue
Issue-ID: DCAEGEN2-2485
Signed-off-by: dhebeha <dhebeha.mj71@wipro.com>
Change-Id: I91fe9b1b86579da7142955ac7adaa25ac4bc22e9
Diffstat (limited to 'components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConsumerThread.java')
-rw-r--r-- | components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConsumerThread.java | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConsumerThread.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConsumerThread.java index 39235cd5..6868bc46 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConsumerThread.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConsumerThread.java @@ -21,6 +21,8 @@ package org.onap.slice.analysis.ms.service; +import java.util.List; + import org.onap.slice.analysis.ms.configdb.IConfigDbService; import org.onap.slice.analysis.ms.models.Configuration; import org.onap.slice.analysis.ms.utils.BeanUtil; @@ -31,7 +33,7 @@ import org.slf4j.LoggerFactory; * This Thread class consumes message from pm data queue and sends onset message to policy */ public class ConsumerThread extends Thread { - private static Logger log = LoggerFactory.getLogger(PmThread.class); + private static Logger log = LoggerFactory.getLogger(ConsumerThread.class); private PmDataQueue pmDataQueue; private IConfigDbService configDbService; private SnssaiSamplesProcessor snssaiSamplesProcessor; @@ -55,16 +57,31 @@ public class ConsumerThread extends Thread { public void run() { boolean done = false; String snssai = ""; + boolean result = false; + List<String> nfs = null; while (!done) { try { Thread.sleep(initialDelaySec); snssai = pmDataQueue.getSnnsaiFromQueue(); if (!snssai.equals("")) { - log.info("Consumer thread started for s-nssai {}",snssai); - snssaiSamplesProcessor.processSamplesOfSnnsai(snssai, configDbService.fetchNetworkFunctionsOfSnssai(snssai)); + log.info("Consumer thread processing data for s-nssai {}",snssai); + try { + nfs = configDbService.fetchNetworkFunctionsOfSnssai(snssai); + } + catch(Exception e) { + pmDataQueue.putSnssaiToQueue(snssai); + log.error("Exception caught while fetching nfs of snssai {}, {}", snssai, e.getMessage()); + } + if(nfs != null) { + result = snssaiSamplesProcessor.processSamplesOfSnnsai(snssai, nfs); + if(!result) { + log.info("Not enough samples to process for {}",snssai); + pmDataQueue.putSnssaiToQueue(snssai); + } + } } } catch (Exception e) { - log.error("Exception in Consumer Thread ", e); + log.error("Exception in Consumer Thread, {}", e.getMessage()); done = true; } } |