diff options
author | 2022-09-02 17:14:13 +0800 | |
---|---|---|
committer | 2022-09-06 14:18:49 +0000 | |
commit | e37979a0a96f59b75b2df4f299840b6caeeb6ee8 (patch) | |
tree | 0fd2d61d6461799db6f9316d7d65083a7f499c16 /components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms | |
parent | 8db39359abef9f94c8cbec10189cd295cf1d814f (diff) |
Fix Sent Wrong Dmaap Message Issue
Fix Sent Wrong Dmaap Message Issue
Issue-ID: DCAEGEN2-3245
Signed-off-by: ChuanyuChen <chenchuanyu@huawei.com>
Change-Id: I8ff10e85bffc044022cfc3bcba21bdd757ffe8ce
Diffstat (limited to 'components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms')
-rw-r--r-- | components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/NotificationProducer.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/NotificationProducer.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/NotificationProducer.java index 55f24a65..66e5d5df 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/NotificationProducer.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/NotificationProducer.java @@ -22,14 +22,14 @@ package org.onap.slice.analysis.ms.dmaap; -import com.google.gson.JsonPrimitive; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import java.io.IOException; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.MessageRouterPublisher; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRouterPublishRequest; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRouterPublishResponse; import reactor.core.publisher.Flux; -import java.io.IOException; - /** * Produces Notification on DMAAP events */ @@ -51,7 +51,8 @@ public class NotificationProducer { * sends notification to dmaap. */ public void sendNotification(String msg) throws IOException { - Flux<JsonPrimitive> singleMessage = Flux.just(msg).map(JsonPrimitive::new); + JsonElement jsonElement = JsonParser.parseString(msg); + Flux<JsonElement> singleMessage = Flux.just(jsonElement); Flux<MessageRouterPublishResponse> result = this.publisher.put(request, singleMessage); result.then().block(); } |