aboutsummaryrefslogtreecommitdiffstats
path: root/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
diff options
context:
space:
mode:
authormicdzied <michal.1.dziedzic@nokia.com>2018-08-30 10:25:19 +0200
committermicdzied <michal.1.dziedzic@nokia.com>2018-08-30 14:53:20 +0200
commit6fd8c7770fbea30ad2ec6e3f7645b8baab5a49a1 (patch)
tree78d572b5df8c88047d74edf3c75b28fcab3d0dc6 /prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
parent82a6fc31d1905f380fbbae1d0b4a34b67d8258e3 (diff)
add MDC's
Change-Id: Ie4fe86791f46b790ae42088a5d2b93f491e4549d Issue-ID: DCAEGEN2-730 Signed-off-by: micdzied <michal.1.dziedzic@nokia.com>
Diffstat (limited to 'prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java')
-rw-r--r--prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
index b06ebfdd..d049d380 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
@@ -20,13 +20,19 @@
package org.onap.dcaegen2.services.prh.service.producer;
+import static org.onap.dcaegen2.services.prh.model.logging.MDCVariables.REQUEST_ID;
+import static org.onap.dcaegen2.services.prh.model.logging.MDCVariables.X_INVOCATION_ID;
+import static org.onap.dcaegen2.services.prh.model.logging.MDCVariables.X_ONAP_REQUEST_ID;
+
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.UUID;
import org.apache.http.client.utils.URIBuilder;
import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.http.HttpStatus;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.WebClient;
@@ -38,12 +44,11 @@ import reactor.core.publisher.Mono;
public class DMaaPProducerReactiveHttpClient {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private WebClient webClient;
private final String dmaapHostName;
private final Integer dmaapPortNumber;
private final String dmaapProtocol;
private final String dmaapTopicName;
+ private WebClient webClient;
/**
* Constructor DMaaPProducerReactiveHttpClient.
@@ -68,6 +73,8 @@ public class DMaaPProducerReactiveHttpClient {
return webClient
.post()
.uri(getUri())
+ .header(X_ONAP_REQUEST_ID, MDC.get(REQUEST_ID))
+ .header(X_INVOCATION_ID, UUID.randomUUID().toString())
.body(BodyInserters.fromObject(consumerDmaapModelMono))
.retrieve()
.onStatus(HttpStatus::is4xxClientError, clientResponse ->