diff options
Diffstat (limited to 'prh-app-server')
3 files changed, 9 insertions, 5 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java index f1483321..7f2cc696 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java @@ -78,12 +78,17 @@ public class DmaapConsumerJsonParser { * @param monoMessage - results from DMaaP * @return reactive DMaaPModel */ - public Flux<ConsumerDmaapModel> getJsonObject(Mono<JsonArray> monoMessage) { + public Flux<ConsumerDmaapModel> getJsonObject(Mono<JsonElement> monoMessage) { return monoMessage .flatMapMany(this::getConsumerDmaapModelFromJsonArray); } - private Flux<ConsumerDmaapModel> getConsumerDmaapModelFromJsonArray(JsonArray jsonArray) { + private Flux<ConsumerDmaapModel> getConsumerDmaapModelFromJsonArray(JsonElement jsonElement) { + + if(jsonElement instanceof JsonObject) + return create(Flux.just((JsonObject) jsonElement)); + + JsonArray jsonArray = (JsonArray) jsonElement; if(jsonArray.size() == 0) { LOGGER.debug("Nothing to consume from DMaaP"); return Flux.empty(); diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java index 998a9243..d3bee5ee 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java @@ -30,7 +30,6 @@ import org.onap.dcaegen2.services.prh.model.utils.HttpUtils; import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration; import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.AaiHttpClientFactory; import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.patch.AaiHttpPatchClient; -import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.CloudHttpClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; 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 3318d331..0d71477c 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,7 +20,7 @@ package org.onap.dcaegen2.services.prh.tasks; -import com.google.gson.JsonArray; +import com.google.gson.JsonElement; import java.util.Optional; import javax.net.ssl.SSLException; import org.onap.dcaegen2.services.prh.configuration.Config; @@ -71,7 +71,7 @@ public class DmaapConsumerTaskImpl implements DmaapConsumerTask { public Flux<ConsumerDmaapModel> execute(String object) throws SSLException { DMaaPConsumerReactiveHttpClient dmaaPConsumerReactiveHttpClient = resolveClient(); LOGGER.debug("Method called with arg {}", object); - Mono<JsonArray> response = dmaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse( + Mono<JsonElement> response = dmaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse( Optional.empty()); return dmaapConsumerJsonParser.getJsonObject(response); } |