diff options
Diffstat (limited to 'prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer')
-rw-r--r-- | prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java | 12 |
1 files changed, 6 insertions, 6 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 ac13dd61..f9a66378 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 @@ -29,9 +29,8 @@ import java.net.URISyntaxException; import java.util.UUID; import org.apache.http.client.utils.URIBuilder; import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.slf4j.MDC; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; @@ -41,13 +40,13 @@ import reactor.core.publisher.Mono; */ public class DMaaPConsumerReactiveHttpClient { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final String dmaapHostName; private final String dmaapProtocol; private final Integer dmaapPortNumber; private final String dmaapTopicName; private final String consumerGroup; private final String consumerId; + private final String contentType; private WebClient webClient; /** @@ -62,6 +61,7 @@ public class DMaaPConsumerReactiveHttpClient { this.dmaapTopicName = consumerConfiguration.dmaapTopicName(); this.consumerGroup = consumerConfiguration.consumerGroup(); this.consumerId = consumerConfiguration.consumerId(); + this.contentType = consumerConfiguration.dmaapContentType(); } /** @@ -76,15 +76,15 @@ public class DMaaPConsumerReactiveHttpClient { .uri(getUri()) .header(X_ONAP_REQUEST_ID, MDC.get(REQUEST_ID)) .header(X_INVOCATION_ID, UUID.randomUUID().toString()) + .header(HttpHeaders.CONTENT_TYPE, contentType) .retrieve() .onStatus(HttpStatus::is4xxClientError, clientResponse -> - Mono.error(new Exception("DmaaPConsumer HTTP " + clientResponse.statusCode())) + Mono.error(new RuntimeException("DmaaPConsumer HTTP " + clientResponse.statusCode())) ) .onStatus(HttpStatus::is5xxServerError, clientResponse -> - Mono.error(new Exception("DmaaPConsumer HTTP " + clientResponse.statusCode()))) + Mono.error(new RuntimeException("DmaaPConsumer HTTP " + clientResponse.statusCode()))) .bodyToMono(String.class); } catch (URISyntaxException e) { - logger.warn("Exception while evaluating URI "); return Mono.error(e); } } |