diff options
author | Guangrong Fu <fu.guangrong@zte.com.cn> | 2021-12-01 14:24:40 +0800 |
---|---|---|
committer | Guangrong Fu <fu.guangrong@zte.com.cn> | 2021-12-01 14:24:40 +0800 |
commit | 11af2e24c981b080c2df3ecbf9574dbef56c47dc (patch) | |
tree | 31ff7ab35e5fcba11c17e328f44210ab4f002082 /engine-d/src/main/java/org/onap/holmes/engine/dmaap/SubscriberAction.java | |
parent | 97afdabeb7d1f2095f3fa170f0f78fb366c91644 (diff) |
Change rule retrieval from CBS to ConfigMap
Issue-ID: HOLMES-488
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
Change-Id: Ia2c29489b37feb729940ee807471ae448c1911cc
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.java | 11 |
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."); } } |