diff options
Diffstat (limited to 'components/bbs-event-processor/src/main/java/org/onap/bbs/event/processor/utilities/CpeAuthenticationDmaapConsumerJsonParser.java')
-rw-r--r-- | components/bbs-event-processor/src/main/java/org/onap/bbs/event/processor/utilities/CpeAuthenticationDmaapConsumerJsonParser.java | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/components/bbs-event-processor/src/main/java/org/onap/bbs/event/processor/utilities/CpeAuthenticationDmaapConsumerJsonParser.java b/components/bbs-event-processor/src/main/java/org/onap/bbs/event/processor/utilities/CpeAuthenticationDmaapConsumerJsonParser.java index 2bb5d98a..3cff4e65 100644 --- a/components/bbs-event-processor/src/main/java/org/onap/bbs/event/processor/utilities/CpeAuthenticationDmaapConsumerJsonParser.java +++ b/components/bbs-event-processor/src/main/java/org/onap/bbs/event/processor/utilities/CpeAuthenticationDmaapConsumerJsonParser.java @@ -37,7 +37,6 @@ import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import com.google.gson.JsonSyntaxException; import java.util.Optional; import java.util.stream.StreamSupport; @@ -79,20 +78,9 @@ public class CpeAuthenticationDmaapConsumerJsonParser { * @param dmaapResponse Response from DMaaP * @return CPE Authentication Consumer DMaaP reactive model */ - public Flux<CpeAuthenticationConsumerDmaapModel> extractModelFromDmaap(Mono<String> dmaapResponse) { + public Flux<CpeAuthenticationConsumerDmaapModel> extractModelFromDmaap(Mono<JsonElement> dmaapResponse) { return dmaapResponse - .flatMapMany(this::parseToMono) - .flatMap(this::createTargetFlux); - } - - private Mono<JsonElement> parseToMono(String message) { - if (StringUtils.isEmpty(message)) { - LOGGER.warn("DMaaP response is empty"); - return Mono.empty(); - } - return Mono.fromCallable(() -> new JsonParser().parse(message)) - .doOnError(e -> e instanceof JsonSyntaxException, e -> LOGGER.error("Invalid JSON. Ignoring")) - .onErrorResume(e -> e instanceof JsonSyntaxException, e -> Mono.empty()); + .flatMapMany(this::createTargetFlux); } private Flux<CpeAuthenticationConsumerDmaapModel> createTargetFlux(JsonElement jsonElement) { |