diff options
Diffstat (limited to 'engine-d/src/main/java')
-rw-r--r-- | engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java | 4 | ||||
-rw-r--r-- | engine-d/src/main/java/org/onap/holmes/engine/dcae/DcaeConfigurationPolling.java | 24 |
2 files changed, 14 insertions, 14 deletions
diff --git a/engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java b/engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java index 9f604b1..4f5593c 100644 --- a/engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java +++ b/engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java @@ -42,7 +42,6 @@ public class EngineDActiveApp extends IOCApplication<EngineDAppConfig> { super.run(configuration, environment); environment.jersey().register(new EngineResources()); - try { new MSBRegisterUtil().register2Msb(createMicroServiceInfo()); } catch (CorrelationException e) { @@ -50,7 +49,8 @@ public class EngineDActiveApp extends IOCApplication<EngineDAppConfig> { } ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); - service.scheduleAtFixedRate(new DcaeConfigurationPolling("holmes-engine-mgmt"), 0, + service.scheduleAtFixedRate( + new DcaeConfigurationPolling(MicroServiceConfig.getEnv(MicroServiceConfig.HOSTNAME)), 0, DcaeConfigurationPolling.POLLING_PERIOD, TimeUnit.MILLISECONDS); } diff --git a/engine-d/src/main/java/org/onap/holmes/engine/dcae/DcaeConfigurationPolling.java b/engine-d/src/main/java/org/onap/holmes/engine/dcae/DcaeConfigurationPolling.java index 4808009..9f892de 100644 --- a/engine-d/src/main/java/org/onap/holmes/engine/dcae/DcaeConfigurationPolling.java +++ b/engine-d/src/main/java/org/onap/holmes/engine/dcae/DcaeConfigurationPolling.java @@ -25,13 +25,11 @@ import org.onap.holmes.dsa.dmaappolling.Subscriber; import org.onap.holmes.engine.dmaap.SubscriberAction; @Slf4j -public class DcaeConfigurationPolling implements Runnable{ +public class DcaeConfigurationPolling implements Runnable { private String hostname; - private String subscriberKey = "sec_fault_unsecure"; - - public static long POLLING_PERIOD = 10 * 1000L; + public static long POLLING_PERIOD = 30 * 1000L; public DcaeConfigurationPolling(String hostname) { this.hostname = hostname; @@ -44,21 +42,23 @@ public class DcaeConfigurationPolling implements Runnable{ dcaeConfigurations = DcaeConfigurationQuery .getDcaeConfigurations(hostname); } catch (CorrelationException e) { - log.error("Failed to polling dcae configurations" + e.getMessage()); + log.error("Failed to poll the DCAE configurations. " + e.getMessage()); } if (dcaeConfigurations != null) { DcaeConfigurationsCache.setDcaeConfigurations(dcaeConfigurations); - addSubscriber(dcaeConfigurations); + addSubscribers(dcaeConfigurations); } } - private void addSubscriber(DcaeConfigurations dcaeConfigurations) { + private void addSubscribers(DcaeConfigurations dcaeConfigurations) { SubscriberAction subscriberAction = ServiceLocatorHolder.getLocator() .getService(SubscriberAction.class); - Subscriber subscriber = new Subscriber(); - subscriber.setTopic(subscriberKey); - subscriber.setUrl(dcaeConfigurations.getSubSecInfo(subscriberKey).getDmaapInfo() - .getTopicUrl()); - subscriberAction.addSubscriber(subscriber); + for (String key : dcaeConfigurations.getSubKeys()) { + Subscriber subscriber = new Subscriber(); + subscriber.setTopic(key); + subscriber.setUrl(dcaeConfigurations.getSubSecInfo(key).getDmaapInfo() + .getTopicUrl()); + subscriberAction.addSubscriber(subscriber); + } } } |