aboutsummaryrefslogtreecommitdiffstats
path: root/PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientUEB.java
diff options
context:
space:
mode:
Diffstat (limited to 'PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientUEB.java')
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientUEB.java74
1 files changed, 37 insertions, 37 deletions
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientUEB.java b/PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientUEB.java
index f84568aba..6bfcd2c7a 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientUEB.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/std/AutoClientUEB.java
@@ -103,44 +103,44 @@ public class AutoClientUEB implements Runnable {
String group = UUID.randomUUID ().toString ();
String id = "0";
// Stop and Start needs to be done.
- if (scheme != null && handler!=null) {
- if (scheme.equals(NotificationScheme.AUTO_ALL_NOTIFICATIONS) || scheme.equals(NotificationScheme.AUTO_NOTIFICATIONS)) {
- URL aURL;
- try {
- aURL = new URL(AutoClientUEB.topic);
- setTopic(aURL.getHost() + aURL.getPort());
- } catch (MalformedURLException e) {
- setTopic(AutoClientUEB.url.replace("[:/]", ""));
- }
- try {
- ConsumerBuilder builder = new CambriaClientBuilders.ConsumerBuilder();
- builder.knownAs(group, id)
- .usingHosts(uebURLList)
- .onTopic(topic)
- .waitAtServer(15*1000)
- .receivingAtMost(1000)
- .authenticatedBy(apiKey, apiSecret);
- setConsumer(builder.build());
- } catch (Exception e1) {
- logger.error("Exception Occured" + e1);
- }
- while (this.isRunning()) {
- try {
- for (String msg : cConsumer.fetch()) {
- logger.debug("Auto Notification Recieved Message " + msg + " from UEB cluster : "
- + uebURLList.toString());
- setNotification(NotificationUnMarshal.notificationJSON(msg));
- callHandler();
- }
- } catch (Exception e) {
- logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Error in processing UEB message"
- + e.getMessage(), e);
- }
-
- }
- logger.debug("Stopping UEB Consumer loop will not logger fetch messages from the cluster");
- }
+ if (scheme == null || handler == null ||
+ ! (scheme.equals(NotificationScheme.AUTO_ALL_NOTIFICATIONS) || scheme.equals(NotificationScheme.AUTO_NOTIFICATIONS)) ) {
+ return;
}
+ URL aURL;
+ try {
+ aURL = new URL(AutoClientUEB.topic);
+ setTopic(aURL.getHost() + aURL.getPort());
+ } catch (MalformedURLException e) {
+ setTopic(AutoClientUEB.url.replace("[:/]", ""));
+ }
+ try {
+ ConsumerBuilder builder = new CambriaClientBuilders.ConsumerBuilder();
+ builder.knownAs(group, id)
+ .usingHosts(uebURLList)
+ .onTopic(topic)
+ .waitAtServer(15*1000)
+ .receivingAtMost(1000)
+ .authenticatedBy(apiKey, apiSecret);
+ setConsumer(builder.build());
+ } catch (Exception e1) {
+ logger.error("Exception Occured" + e1);
+ }
+ while (this.isRunning()) {
+ try {
+ for (String msg : cConsumer.fetch()) {
+ logger.debug("Auto Notification Recieved Message " + msg + " from UEB cluster : "
+ + uebURLList.toString());
+ setNotification(NotificationUnMarshal.notificationJSON(msg));
+ callHandler();
+ }
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Error in processing UEB message"
+ + e.getMessage(), e);
+ }
+
+ }
+ logger.debug("Stopping UEB Consumer loop will not logger fetch messages from the cluster");
}
private static void setNotification(StdPDPNotification notificationJSON) {