From 4ee18157bfcf53e256be4c6bb928c658b027cab5 Mon Sep 17 00:00:00 2001 From: sunil unnava Date: Thu, 6 Dec 2018 06:35:09 -0500 Subject: Fix for Kafka Consumer is not safe error Issue-ID: DMAAP-896 Change-Id: If3e93533b1d6f37ef7b2685c83e4785d62257ffa Signed-off-by: sunil unnava --- pom.xml | 27 ++++++++++++++++++++-- .../org/onap/dmaap/service/EventsRestService.java | 21 +---------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index ea8f069..5de6742 100644 --- a/pom.xml +++ b/pom.xml @@ -262,7 +262,7 @@ workstation DEV - 1.1.8 + 1.1.9 2.21.1 /content/sites/site/org/onap/dmaap/messagerouter/messageservice/${project.artifactId}/${project.version} true @@ -457,7 +457,7 @@ org.onap.dmaap.messagerouter.msgrtr msgrtr - 1.1.13 + 1.1.14-SNAPSHOT org.slf4j @@ -1337,6 +1337,29 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-no-snapshots + + enforce + + + + + No Snapshots Allowed! + + org.onap.dmaap.messagerouter.msgrtr:msgrtr + + + + true + + + + diff --git a/src/main/java/org/onap/dmaap/service/EventsRestService.java b/src/main/java/org/onap/dmaap/service/EventsRestService.java index b4aee10..d3abd6b 100644 --- a/src/main/java/org/onap/dmaap/service/EventsRestService.java +++ b/src/main/java/org/onap/dmaap/service/EventsRestService.java @@ -21,6 +21,7 @@ *******************************************************************************/ package org.onap.dmaap.service; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Date; @@ -97,7 +98,6 @@ public class EventsRestService { @Autowired private DMaaPErrorMessages errorMessages; - private boolean isOffsetTopicCreated=false; /** * This method is used to consume messages.Taking three parameter @@ -257,9 +257,6 @@ public class EventsRestService { @QueryParam("partitionKey") String partitionKey) throws CambriaApiException { log.info("Publishing message to topic " + topic); - if(!isOffsetTopicCreated){ - preCreateOffsetTopic(msg); - } try { eventsService.pushEvents(getDmaapContext(), topic, msg, partitionKey, null); } @@ -322,10 +319,6 @@ public class EventsRestService { try { - if(!isOffsetTopicCreated){ - preCreateOffsetTopic(request.getInputStream()); - } - eventsService.pushEvents(getDmaapContext(), topic, request.getInputStream(), partitionKey, Utils.getFormattedDate(new Date())); @@ -386,17 +379,5 @@ public class EventsRestService { return dmaapContext; } - private void preCreateOffsetTopic(InputStream msg) { - - try { - eventsService.pushEvents(getDmaapContext(), "DUMMY_TOPIC", msg, null, null); - eventsService.getEvents(getDmaapContext(), "DUMMY_TOPIC", "CG1", "C1"); - isOffsetTopicCreated = true; - } catch (CambriaApiException | ConfigDbException | AccessDeniedException | TopicExistsException | IOException - | missingReqdSetting | UnavailableException e) { - log.error("Error while creating the dummy topic", e); - } - - } } \ No newline at end of file -- cgit 1.2.3-korg