summaryrefslogtreecommitdiffstats
path: root/engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java
diff options
context:
space:
mode:
authortang peng <tang.peng5@zte.com.cn>2021-12-01 07:05:55 +0000
committerGerrit Code Review <gerrit@onap.org>2021-12-01 07:05:55 +0000
commit560291e128455ccb139847b5cb410b10097cd387 (patch)
tree23ca0eef5a5644fbcd46d5d594af9daf220ce373 /engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java
parentbffabda06aa6c5b8027ecdc98f812df2d2c45cba (diff)
parent11af2e24c981b080c2df3ecbf9574dbef56c47dc (diff)
Merge "Change rule retrieval from CBS to ConfigMap"
Diffstat (limited to 'engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java')
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java b/engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java
index c96b813..1297f11 100644
--- a/engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 ZTE Corporation.
+ * Copyright 2017 - 2021 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,13 +39,18 @@ public class SubscriberAction {
public synchronized void addSubscriber(Subscriber subscriber) {
String topic = subscriber.getTopic();
- if (topic != null && !pollingTasks.containsKey(topic)) {
+ if (topic != null) {
+ if (pollingTasks.containsKey(topic)) {
+ removeSubscriber(subscriber);
+ }
AlarmInfoDao alarmInfoDao = daoUtil.getJdbiDaoByOnDemand(AlarmInfoDao.class);
DMaaPAlarmPolling pollingTask = new DMaaPAlarmPolling(subscriber, droolsEngine, alarmInfoDao);
Thread thread = new Thread(pollingTask);
thread.start();
pollingTasks.put(topic, pollingTask);
- log.info("Subscribe to topic: " + subscriber.getUrl());
+ log.info("Subscribed to topic: " + subscriber.getUrl());
+ } else {
+ log.info("The topic is null. Operation aborted.");
}
}