aboutsummaryrefslogtreecommitdiffstats
path: root/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java
diff options
context:
space:
mode:
authorpwielebs <piotr.wielebski@nokia.com>2018-09-04 09:44:33 +0200
committerpwielebs <piotr.wielebski@nokia.com>2018-09-04 09:44:33 +0200
commita4c979b6de8c1c76f0f12ae2b8dd0e60c3084830 (patch)
tree5fd8eca8889fb37000b834128fdd742dc05664df /prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java
parent3737046ff3c8e032257b257912778403fc058ee0 (diff)
Fixing code issues
1. SonarIssues 2. CheckStyle corrections 3. Empty code deletions 4. Adding AAIHeaders config to cloud configurations Change-Id: Id624c52bc7f57338fad5276fffd9f29b21af2f69 Issue-ID: DCAEGEN2-606 Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java')
-rw-r--r--prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java
index ab6686db..242214d2 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java
@@ -27,6 +27,7 @@ import static org.onap.dcaegen2.services.prh.model.logging.MdcVariables.X_ONAP_R
import java.net.URI;
import java.net.URISyntaxException;
import java.util.UUID;
+import java.util.function.Consumer;
import org.apache.http.client.utils.URIBuilder;
import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
import org.slf4j.MDC;
@@ -74,9 +75,7 @@ public class DMaaPConsumerReactiveHttpClient {
return webClient
.get()
.uri(getUri())
- .header(X_ONAP_REQUEST_ID, MDC.get(REQUEST_ID))
- .header(X_INVOCATION_ID, UUID.randomUUID().toString())
- .header(HttpHeaders.CONTENT_TYPE, contentType)
+ .headers(getHeaders())
.retrieve()
.onStatus(HttpStatus::is4xxClientError, clientResponse ->
Mono.error(new RuntimeException("DmaaPConsumer HTTP " + clientResponse.statusCode()))
@@ -89,6 +88,14 @@ public class DMaaPConsumerReactiveHttpClient {
}
}
+ private Consumer<HttpHeaders> getHeaders() {
+ return httpHeaders -> {
+ httpHeaders.set(X_ONAP_REQUEST_ID, MDC.get(REQUEST_ID));
+ httpHeaders.set(X_INVOCATION_ID, UUID.randomUUID().toString());
+ httpHeaders.set(HttpHeaders.CONTENT_TYPE, contentType);
+ };
+ }
+
private String createRequestPath() {
return dmaapTopicName + "/" + consumerGroup + "/" + consumerId;
}