aboutsummaryrefslogtreecommitdiffstats
path: root/datafile-app-server
diff options
context:
space:
mode:
authorelinuxhenrik <henrik.b.andersson@est.tech>2018-10-01 16:51:05 +0200
committerelinuxhenrik <henrik.b.andersson@est.tech>2018-10-02 10:38:30 +0200
commit18f56936071b59b6efd61c2764c51ecd52ced74c (patch)
tree0a348e5e788398f75e561b6cf76957238dcab375 /datafile-app-server
parentf3e28b23e4256b5c88d328743bb66d0d6766f542 (diff)
Handle redirect from DataRouter properly
Change-Id: I1eae8b45a2437b97bccedcb0f5cc02ac29f5044f Issue-ID: DCAEGEN2-850 Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Diffstat (limited to 'datafile-app-server')
-rw-r--r--datafile-app-server/config/application.yaml2
-rw-r--r--datafile-app-server/config/datafile_endpoints.json12
-rw-r--r--datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/DmaapPublisherTask.java12
-rw-r--r--datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/DmaapPublisherTaskImpl.java15
-rw-r--r--datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/ScheduledTasks.java2
-rw-r--r--datafile-app-server/src/main/resources/datafile_endpoints.json12
-rw-r--r--datafile-app-server/src/test/resources/datafile_endpoints.json12
7 files changed, 26 insertions, 41 deletions
diff --git a/datafile-app-server/config/application.yaml b/datafile-app-server/config/application.yaml
index ca3160c7..cef185c6 100644
--- a/datafile-app-server/config/application.yaml
+++ b/datafile-app-server/config/application.yaml
@@ -14,7 +14,7 @@ logging:
ROOT: ERROR
org.springframework: ERROR
org.springframework.data: ERROR
- org.onap.dcaegen2.collectors.datafile: INFO
+ org.onap.dcaegen2.collectors.datafile: ERROR
file: opt/log/application.log
app:
filepath: config/datafile_endpoints.json
diff --git a/datafile-app-server/config/datafile_endpoints.json b/datafile-app-server/config/datafile_endpoints.json
index 102537b1..5664bdeb 100644
--- a/datafile-app-server/config/datafile_endpoints.json
+++ b/datafile-app-server/config/datafile_endpoints.json
@@ -3,24 +3,24 @@
"dmaap": {
"dmaapConsumerConfiguration": {
"dmaapHostName": "localhost",
- "dmaapPortNumber": 3904,
+ "dmaapPortNumber": 2222,
"dmaapTopicName": "/events/unauthenticated.VES_NOTIFICATION_OUTPUT",
"dmaapProtocol": "http",
"dmaapUserName": "admin",
"dmaapUserPassword": "admin",
"dmaapContentType": "application/json",
- "consumerId": "c12",
+ "consumerId": "C12",
"consumerGroup": "OpenDcae-c12",
"timeoutMS": -1,
"messageLimit": 1
},
"dmaapProducerConfiguration": {
"dmaapHostName": "localhost",
- "dmaapPortNumber": 3905,
+ "dmaapPortNumber": 3907,
"dmaapTopicName": "publish",
- "dmaapProtocol": "http",
- "dmaapUserName": "admin",
- "dmaapUserPassword": "admin",
+ "dmaapProtocol": "https",
+ "dmaapUserName": "dradmin",
+ "dmaapUserPassword": "dradmin",
"dmaapContentType": "application/octet-stream"
}
}
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/DmaapPublisherTask.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/DmaapPublisherTask.java
index 0b81df5b..8508cd12 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/DmaapPublisherTask.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/DmaapPublisherTask.java
@@ -18,9 +18,7 @@ package org.onap.dcaegen2.collectors.datafile.tasks;
import org.onap.dcaegen2.collectors.datafile.config.DmaapPublisherConfiguration;
import org.onap.dcaegen2.collectors.datafile.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.collectors.datafile.service.DmaapReactiveWebClient;
import org.onap.dcaegen2.collectors.datafile.service.producer.DmaapProducerReactiveHttpClient;
-import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
@@ -30,15 +28,9 @@ import reactor.core.publisher.Flux;
*/
abstract class DmaapPublisherTask {
- abstract Flux<String> publish(ConsumerDmaapModel consumerDmaapModel);
-
- abstract DmaapProducerReactiveHttpClient resolveClient();
-
protected abstract DmaapPublisherConfiguration resolveConfiguration();
- protected abstract Flux<String> execute(ConsumerDmaapModel consumerDmaapModel);
+ protected abstract DmaapProducerReactiveHttpClient resolveClient();
- WebClient buildWebClient() {
- return new DmaapReactiveWebClient().fromConfiguration(resolveConfiguration()).build();
- }
+ protected abstract Flux<String> execute(ConsumerDmaapModel consumerDmaapModel);
}
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/DmaapPublisherTaskImpl.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/DmaapPublisherTaskImpl.java
index b4ee3a9d..201b33d1 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/DmaapPublisherTaskImpl.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/DmaapPublisherTaskImpl.java
@@ -37,7 +37,6 @@ public class DmaapPublisherTaskImpl extends DmaapPublisherTask {
private static final Logger logger = LoggerFactory.getLogger(DmaapPublisherTaskImpl.class);
private final Config datafileAppConfig;
- private DmaapProducerReactiveHttpClient dmaapProducerReactiveHttpClient;
@Autowired
public DmaapPublisherTaskImpl(AppConfig datafileAppConfig) {
@@ -45,16 +44,10 @@ public class DmaapPublisherTaskImpl extends DmaapPublisherTask {
}
@Override
- public Flux<String> publish(ConsumerDmaapModel consumerDmaapModel) {
- logger.trace("Publishing on DMaaP DataRouter {}", consumerDmaapModel);
- return dmaapProducerReactiveHttpClient.getDmaapProducerResponse(consumerDmaapModel);
- }
-
- @Override
public Flux<String> execute(ConsumerDmaapModel consumerDmaapModel) {
- dmaapProducerReactiveHttpClient = resolveClient();
logger.trace("Method called with arg {}", consumerDmaapModel);
- return publish(consumerDmaapModel);
+ DmaapProducerReactiveHttpClient dmaapProducerReactiveHttpClient = resolveClient();
+ return dmaapProducerReactiveHttpClient.getDmaapProducerResponse(consumerDmaapModel);
}
@Override
@@ -63,8 +56,8 @@ public class DmaapPublisherTaskImpl extends DmaapPublisherTask {
}
@Override
- DmaapProducerReactiveHttpClient resolveClient() {
- return new DmaapProducerReactiveHttpClient(resolveConfiguration()).createDmaapWebClient(buildWebClient());
+ protected DmaapProducerReactiveHttpClient resolveClient() {
+ return new DmaapProducerReactiveHttpClient(resolveConfiguration());
}
}
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/ScheduledTasks.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/ScheduledTasks.java
index c263c95c..171dd024 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/ScheduledTasks.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/tasks/ScheduledTasks.java
@@ -61,7 +61,7 @@ public class ScheduledTasks {
logger.trace("Execution of tasks was registered");
consumeFromDmaapMessage()
- .doOnError(DmaapEmptyResponseException.class, error -> logger.error("Nothing to consume from DMaaP"))
+ .doOnError(DmaapEmptyResponseException.class, error -> logger.info("Nothing to consume from DMaaP"))
.flatMap(this::collectFilesFromXnf).flatMap(this::publishToDmaapConfiguration)
.subscribe(this::onSuccess, this::onError, this::onComplete);
}
diff --git a/datafile-app-server/src/main/resources/datafile_endpoints.json b/datafile-app-server/src/main/resources/datafile_endpoints.json
index 188129e8..dff77d2f 100644
--- a/datafile-app-server/src/main/resources/datafile_endpoints.json
+++ b/datafile-app-server/src/main/resources/datafile_endpoints.json
@@ -3,10 +3,10 @@
"dmaap": {
"dmaapConsumerConfiguration": {
"consumerGroup": "notification",
- "consumerId": "1",
+ "consumerId": "C12",
"dmaapContentType": "application/json",
"dmaapHostName": "localhost",
- "dmaapPortNumber": 3904,
+ "dmaapPortNumber": 2222,
"dmaapProtocol": "http",
"dmaapTopicName": "/events/unauthenticated.VES_NOTIFICATION_OUTPUT",
"dmaapUserName": "admin",
@@ -17,11 +17,11 @@
"dmaapProducerConfiguration": {
"dmaapContentType": "application/octet-stream",
"dmaapHostName": "localhost",
- "dmaapPortNumber": 3905,
- "dmaapProtocol": "http",
+ "dmaapPortNumber": 3907,
+ "dmaapProtocol": "https",
"dmaapTopicName": "publish",
- "dmaapUserName": "admin",
- "dmaapUserPassword": "admin"
+ "dmaapUserName": "dradmin",
+ "dmaapUserPassword": "dradmin"
}
}
}
diff --git a/datafile-app-server/src/test/resources/datafile_endpoints.json b/datafile-app-server/src/test/resources/datafile_endpoints.json
index 188129e8..dff77d2f 100644
--- a/datafile-app-server/src/test/resources/datafile_endpoints.json
+++ b/datafile-app-server/src/test/resources/datafile_endpoints.json
@@ -3,10 +3,10 @@
"dmaap": {
"dmaapConsumerConfiguration": {
"consumerGroup": "notification",
- "consumerId": "1",
+ "consumerId": "C12",
"dmaapContentType": "application/json",
"dmaapHostName": "localhost",
- "dmaapPortNumber": 3904,
+ "dmaapPortNumber": 2222,
"dmaapProtocol": "http",
"dmaapTopicName": "/events/unauthenticated.VES_NOTIFICATION_OUTPUT",
"dmaapUserName": "admin",
@@ -17,11 +17,11 @@
"dmaapProducerConfiguration": {
"dmaapContentType": "application/octet-stream",
"dmaapHostName": "localhost",
- "dmaapPortNumber": 3905,
- "dmaapProtocol": "http",
+ "dmaapPortNumber": 3907,
+ "dmaapProtocol": "https",
"dmaapTopicName": "publish",
- "dmaapUserName": "admin",
- "dmaapUserPassword": "admin"
+ "dmaapUserName": "dradmin",
+ "dmaapUserPassword": "dradmin"
}
}
}