diff options
author | krishnajinka <krishna.jinka@gmail.com> | 2018-08-05 16:52:10 +0900 |
---|---|---|
committer | Krishnakumar Jinka <kris.jinka@samsung.com> | 2018-08-06 13:33:03 +0000 |
commit | fb3c2a56b46a95c188ec4eec9c98c7bd0b881097 (patch) | |
tree | 8656959845649f512c9bca4c642bb6245e1c4d6e /policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java | |
parent | 7ff19ee29e708be8c7fb3fc4428db0f399c0b4df (diff) |
Apply builder pattern for topic cnsmer prdcr
Modify endpoints event bus related classes to use builder pattern
in particular apply bus topic params object instead of
using parameters as it is. Rework based on commnts
Issue-ID: POLICY-1017
Change-Id: I572a72fa525cf4f664eb70d0415be73116499bd2
Signed-off-by: krisjinka <kris.jinka@samsung.com>
Diffstat (limited to 'policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java')
-rw-r--r-- | policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java index c6bd5568..65f75aa5 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java @@ -3,6 +3,7 @@ * policy-endpoints * ================================================================================ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,18 +85,52 @@ public class SingleThreadedDmaapTopicSource extends SingleThreadedBusTopicSource @Override public void init() throws MalformedURLException { if (anyNullOrEmpty(this.userName, this.password)) { - this.consumer = new BusConsumer.CambriaConsumerWrapper(this.servers, this.topic, this.apiKey, - this.apiSecret, this.consumerGroup, this.consumerInstance, this.fetchTimeout, this.fetchLimit, - this.useHttps, this.allowSelfSignedCerts); + this.consumer = new BusConsumer.CambriaConsumerWrapper(BusTopicParams.builder() + .servers(this.servers) + .topic(this.topic) + .apiKey(this.apiKey) + .apiSecret(this.apiSecret) + .consumerGroup(this.consumerGroup) + .consumerInstance(this.consumerInstance) + .fetchTimeout(this.fetchTimeout) + .fetchLimit(this.fetchLimit) + .useHttps(this.useHttps) + .allowSelfSignedCerts(this.allowSelfSignedCerts) + .build()); } else if (allNullOrEmpty(this.environment, this.aftEnvironment, this.latitude, this.longitude, this.partner)) { - this.consumer = new BusConsumer.CambriaConsumerWrapper(this.servers, this.topic, this.apiKey, - this.apiSecret, this.userName, this.password, this.consumerGroup, this.consumerInstance, - this.fetchTimeout, this.fetchLimit, this.useHttps, this.allowSelfSignedCerts); + this.consumer = new BusConsumer.CambriaConsumerWrapper(BusTopicParams.builder() + .servers(this.servers) + .topic(this.topic) + .apiKey(this.apiKey) + .apiSecret(this.apiSecret) + .userName(this.userName) + .password(this.password) + .consumerGroup(this.consumerGroup) + .consumerInstance(this.consumerInstance) + .fetchTimeout(this.fetchTimeout) + .fetchLimit(this.fetchLimit) + .useHttps(this.useHttps) + .allowSelfSignedCerts(this.allowSelfSignedCerts) + .build()); } else { - this.consumer = new BusConsumer.DmaapDmeConsumerWrapper(this.servers, this.topic, this.apiKey, - this.apiSecret, this.userName, this.password, this.consumerGroup, this.consumerInstance, - this.fetchTimeout, this.fetchLimit, this.environment, this.aftEnvironment, this.partner, - this.latitude, this.longitude, this.additionalProps, this.useHttps); + this.consumer = new BusConsumer.DmaapDmeConsumerWrapper(BusTopicParams.builder() + .servers(this.servers) + .topic(this.topic) + .apiKey(this.apiKey) + .apiSecret(this.apiSecret) + .userName(this.userName) + .password(this.password) + .consumerGroup(this.consumerGroup) + .consumerInstance(this.consumerInstance) + .fetchTimeout(this.fetchTimeout) + .fetchLimit(this.fetchLimit) + .environment(this.environment) + .aftEnvironment(this.aftEnvironment) + .partner(this.partner) + .latitude(this.latitude) + .longitude(this.longitude) + .additionalProps(this.additionalProps) + .useHttps(this.useHttps).build()); } logger.info("{}: INITTED", this); |