summaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/main
diff options
context:
space:
mode:
authorpkaras <piotr.karas@nokia.com>2018-11-06 12:22:28 +0100
committerpkaras <piotr.karas@nokia.com>2018-11-06 13:14:46 +0100
commit8a762124d24555d50ce7455398ca3ac02fde1076 (patch)
treed31fc5feb13438a364e74fc8b4f2d4e9f39f4be7 /prh-app-server/src/main
parent8330d0e6c2cf1d9d8215e13b928530c2277fa974 (diff)
SSL setup for dmaap consumer
Change-Id: I5856554fa05cfd9ad637c0491eb801f9937c967a Issue-ID: DCAEGEN2-951 Signed-off-by: piotr.karas <piotr.karas@nokia.com>
Diffstat (limited to 'prh-app-server/src/main')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java6
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java10
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java10
3 files changed, 19 insertions, 7 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
index 58b29d2e..005cc629 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
@@ -20,10 +20,12 @@
package org.onap.dcaegen2.services.prh.tasks;
+import javax.net.ssl.SSLException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.service.consumer.DMaaPConsumerReactiveHttpClient;
import reactor.core.publisher.Flux;
+
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/13/18
*/
@@ -31,7 +33,7 @@ interface DmaapConsumerTask {
void initConfigs();
- Flux<ConsumerDmaapModel> execute(String object);
+ Flux<ConsumerDmaapModel> execute(String object) throws SSLException;
- DMaaPConsumerReactiveHttpClient resolveClient();
+ DMaaPConsumerReactiveHttpClient resolveClient() throws SSLException;
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
index a52163b7..e46ee89a 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
@@ -20,18 +20,20 @@
package org.onap.dcaegen2.services.prh.tasks;
+import javax.net.ssl.SSLException;
import org.onap.dcaegen2.services.prh.configuration.Config;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.service.DmaapConsumerJsonParser;
import org.onap.dcaegen2.services.prh.service.consumer.ConsumerReactiveHttpClientFactory;
import org.onap.dcaegen2.services.prh.service.consumer.DMaaPConsumerReactiveHttpClient;
-import org.onap.dcaegen2.services.prh.service.consumer.DMaaPReactiveWebClient;
+import org.onap.dcaegen2.services.prh.service.consumer.DMaaPReactiveWebClientFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Flux;
+
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 3/23/18
*/
@@ -46,7 +48,7 @@ public class DmaapConsumerTaskImpl implements DmaapConsumerTask {
@Autowired
public DmaapConsumerTaskImpl(Config config) {
this(config, new DmaapConsumerJsonParser(),
- new ConsumerReactiveHttpClientFactory(new DMaaPReactiveWebClient()));
+ new ConsumerReactiveHttpClientFactory(new DMaaPReactiveWebClientFactory()));
}
DmaapConsumerTaskImpl(Config prhAppConfig,
@@ -63,14 +65,14 @@ public class DmaapConsumerTaskImpl implements DmaapConsumerTask {
}
@Override
- public Flux<ConsumerDmaapModel> execute(String object) {
+ public Flux<ConsumerDmaapModel> execute(String object) throws SSLException {
DMaaPConsumerReactiveHttpClient dmaaPConsumerReactiveHttpClient = resolveClient();
LOGGER.debug("Method called with arg {}", object);
return dmaapConsumerJsonParser.getJsonObject(dmaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse());
}
@Override
- public DMaaPConsumerReactiveHttpClient resolveClient() {
+ public DMaaPConsumerReactiveHttpClient resolveClient() throws SSLException {
return httpClientFactory.create(config.getDmaapConsumerConfiguration());
}
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
index 08767428..d6814ed6 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
@@ -127,10 +127,18 @@ public class ScheduledTasks {
MDC.put(INSTANCE_UUID, UUID.randomUUID().toString());
logger.info(INVOKE, "Init configs");
dmaapConsumerTask.initConfigs();
- return dmaapConsumerTask.execute("");
+ return consumeFromDMaaP();
});
}
+ private Flux<ConsumerDmaapModel> consumeFromDMaaP() {
+ try {
+ return dmaapConsumerTask.execute("");
+ } catch (SSLException e) {
+ return Flux.error(e);
+ }
+ }
+
private Mono<ConsumerDmaapModel> publishToAaiConfiguration(ConsumerDmaapModel monoDMaaPModel) {
try {
return aaiProducerTask.execute(monoDMaaPModel);