aboutsummaryrefslogtreecommitdiffstats
path: root/appc-client/client-lib
diff options
context:
space:
mode:
authorRyan Young <ry303t@att.com>2018-05-30 14:10:10 -0400
committerRyan Young <ry303t@att.com>2018-05-30 14:12:09 -0400
commit38280dcce5a2d489c3e016d531faf043dbaddb41 (patch)
tree9875e4e404c448ed0b3da0dc6bdc919ca858b768 /appc-client/client-lib
parent61f4c8ce5e093db0b63d4030cbd3e6df499854a1 (diff)
Refactor properties used for topic names
Change-Id: Ifc7e5c0c57f64a237c2314ba7a60dabb92e067f1 Signed-off-by: Ryan Young <ry303t@att.com> Issue-ID: APPC-934
Diffstat (limited to 'appc-client/client-lib')
-rw-r--r--appc-client/client-lib/src/main/java/org/onap/appc/client/impl/protocol/UEBMessagingService.java38
1 files changed, 33 insertions, 5 deletions
diff --git a/appc-client/client-lib/src/main/java/org/onap/appc/client/impl/protocol/UEBMessagingService.java b/appc-client/client-lib/src/main/java/org/onap/appc/client/impl/protocol/UEBMessagingService.java
index 0a9e1a630..ed0ee5480 100644
--- a/appc-client/client-lib/src/main/java/org/onap/appc/client/impl/protocol/UEBMessagingService.java
+++ b/appc-client/client-lib/src/main/java/org/onap/appc/client/impl/protocol/UEBMessagingService.java
@@ -41,6 +41,8 @@ class UEBMessagingService implements MessagingService {
private static final String DEFAULT_READ_TIMEOUT_MS = "60000";
private static final String DEFAULT_READ_LIMIT = "1000";
+ private static final String DEFAULT_READ_TOPIC = "client-read";
+ private static final String DEFAULT_WRITE_TOPIC = "client-write";
private Consumer consumer;
private Producer producer;
@@ -52,14 +54,40 @@ class UEBMessagingService implements MessagingService {
throws IOException, GeneralSecurityException, NoSuchFieldException, IllegalAccessException {
if (props != null) {
- String readTopic = props.getProperty(UEBPropertiesKeys.TOPIC_READ);
- String writeTopic = props.getProperty(UEBPropertiesKeys.TOPIC_WRITE);
- String cType = props.getProperty(UEBPropertiesKeys.CONTROLLER_TYPE);
+ String readTopic = null;
+ String writeTopic = null;
+ String cType = props.getProperty(UEBPropertiesKeys.CONTROLLER_TYPE); //CONTROLLER_TYPE = "controllerType"
+
if (cType != null && cType.length()!= 0 && (!cType.equals("APPC")))
{
- readTopic = cType + "-" + readTopic;
- writeTopic = cType + "-" + writeTopic;
+ logger.debug("Using controller type " + cType + " for topic properties");
+
+ readTopic = props.getProperty(cType + "-" + UEBPropertiesKeys.TOPIC_READ);
+ if(readTopic == null) {
+ logger.error("Error reading property '"+ cType + "-" + UEBPropertiesKeys.TOPIC_READ + "' defaulting to " + DEFAULT_READ_TOPIC);
+ readTopic = DEFAULT_READ_TOPIC;
+ }
+ writeTopic = props.getProperty(cType + "-" + UEBPropertiesKeys.TOPIC_WRITE);
+ if(writeTopic == null) {
+ logger.error("Error reading property '"+ cType + "-" + UEBPropertiesKeys.TOPIC_READ + "' defaulting to " + DEFAULT_WRITE_TOPIC);
+ writeTopic = DEFAULT_WRITE_TOPIC;
+ }
}
+ else {
+ readTopic = props.getProperty(UEBPropertiesKeys.TOPIC_READ); //TOPIC_READ = "topic.read"
+ if(readTopic == null) {
+ logger.error("Error reading property '"+ UEBPropertiesKeys.TOPIC_READ + "' defaulting to " + DEFAULT_READ_TOPIC);
+ readTopic = DEFAULT_READ_TOPIC;
+ }
+ writeTopic = props.getProperty(UEBPropertiesKeys.TOPIC_WRITE); //TOPIC_WRITE = "topic.write"
+ if(writeTopic == null) {
+ logger.error("Error reading property '" + UEBPropertiesKeys.TOPIC_READ + "' defaulting to " + DEFAULT_WRITE_TOPIC);
+ writeTopic = DEFAULT_WRITE_TOPIC;
+ }
+ }
+
+ logger.debug("Using topics: Read = '" + readTopic + "' Write = '" + writeTopic + "'");
+
String apiKey = props.getProperty(UEBPropertiesKeys.AUTH_USER);
String apiSecret = props.getProperty(UEBPropertiesKeys.AUTH_SECRET);
String readTimeoutString = props.getProperty(UEBPropertiesKeys.TOPIC_READ_TIMEOUT, DEFAULT_READ_TIMEOUT_MS);