Fix for Kafka Consumer is not safe error 34/74334/1
authorsunil unnava <sunil.unnava@att.com>
Thu, 6 Dec 2018 11:35:09 +0000 (06:35 -0500)
committersunil unnava <sunil.unnava@att.com>
Thu, 6 Dec 2018 11:35:30 +0000 (06:35 -0500)
Issue-ID: DMAAP-896
Change-Id: If3e93533b1d6f37ef7b2685c83e4785d62257ffa
Signed-off-by: sunil unnava <sunil.unnava@att.com>
pom.xml
src/main/java/org/onap/dmaap/service/EventsRestService.java

diff --git a/pom.xml b/pom.xml
index ea8f069..5de6742 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                <testRouteOffer>workstation</testRouteOffer>
                <testEnv>DEV</testEnv>
                <!-- <dmaapImg>${project.version}</dmaapImg> -->
-               <dmaapImg>1.1.8</dmaapImg>
+               <dmaapImg>1.1.9</dmaapImg>
                <camel.version>2.21.1</camel.version>
                <sitePath>/content/sites/site/org/onap/dmaap/messagerouter/messageservice/${project.artifactId}/${project.version}</sitePath>
                <skip.docker.build>true</skip.docker.build>
                <dependency>
                        <groupId>org.onap.dmaap.messagerouter.msgrtr</groupId>
                        <artifactId>msgrtr</artifactId>
-                       <version>1.1.13</version>
+                       <version>1.1.14-SNAPSHOT</version>
                        <exclusions>
                                <exclusion>
                                        <groupId>org.slf4j</groupId>
                                                        </execution>
                                                </executions>
                                        </plugin>
+                                        <plugin>
+                       <groupId>org.apache.maven.plugins</groupId>
+                       <artifactId>maven-enforcer-plugin</artifactId>
+                       <executions>
+                               <execution>
+                                       <id>enforce-no-snapshots</id>
+                                       <goals>
+                                               <goal>enforce</goal>
+                                       </goals>
+                                       <configuration>
+                                               <rules>
+                                                       <requireReleaseDeps>
+                                                               <message>No Snapshots Allowed!</message>
+                                                               <excludes>
+                                                                       <exclude>org.onap.dmaap.messagerouter.msgrtr:msgrtr</exclude>
+                                                               </excludes>
+                                                       </requireReleaseDeps>
+                                               </rules>
+                                               <fail>true</fail>
+                                       </configuration>
+                               </execution>
+                       </executions>
+               </plugin>
                                </plugins>
                                <pluginManagement>
                                        <plugins>
index b4aee10..d3abd6b 100644 (file)
@@ -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