Add Some Log Printing 03/22703/1
authorGuangrong Fu <fu.guangrong@zte.com.cn>
Wed, 8 Nov 2017 06:11:43 +0000 (14:11 +0800)
committerGuangrong Fu <fu.guangrong@zte.com.cn>
Wed, 8 Nov 2017 06:11:43 +0000 (14:11 +0800)
Change-Id: I4d9cbbd02e272bd70e9d31a94ca07de055101123
Issue-ID: HOLMES-86
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
engine-d/src/main/java/org/onap/holmes/engine/dmaap/DMaaPAlarmPolling.java
engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java

index 37b39c0..47bd386 100644 (file)
@@ -40,10 +40,12 @@ public class DMaaPAlarmPolling implements Runnable {
             List<VesAlarm> vesAlarmList = new ArrayList<>();
             try {
                 vesAlarmList = subscriber.subscribe();
+                vesAlarmList.forEach(vesAlarm -> droolsEngine.putRaisedIntoStream(vesAlarm));
             } catch (CorrelationException e) {
                 log.error("Failed polling request alarm. " + e.getMessage());
+            } catch (Exception e) {
+                log.error("An error occurred while processing alarm.", e);
             }
-            vesAlarmList.forEach(vesAlarm -> droolsEngine.putRaisedIntoStream(vesAlarm));
         }
     }
 
index 8d80a6b..12edc99 100644 (file)
@@ -21,11 +21,13 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
+import lombok.extern.slf4j.Slf4j;
 import org.jvnet.hk2.annotations.Service;
 import org.onap.holmes.dsa.dmaappolling.Subscriber;
 import org.onap.holmes.engine.manager.DroolsEngine;
 
 @Service
+@Slf4j
 public class SubscriberAction {
 
     @Inject
@@ -38,6 +40,7 @@ public class SubscriberAction {
             Thread thread = new Thread(pollingTask);
             thread.start();
             pollingTasks.put(subscriber.getTopic(), pollingTask);
+            log.info("Subscribe to topic: " + subscriber.getUrl());
         }
     }
 
@@ -46,6 +49,7 @@ public class SubscriberAction {
             pollingTasks.get(subscriber.getTopic()).stopTask();
             pollingTasks.remove(subscriber.getTopic());
         }
+        log.info("Topic unsubscribed: " + subscriber.getUrl());
     }
 
     @PreDestroy