Fix sonar issue KafkaListenerHandler 21/106321/1
authoredyta <edyta.krukowska@nokia.com>
Tue, 21 Apr 2020 08:14:09 +0000 (10:14 +0200)
committeredyta <edyta.krukowska@nokia.com>
Tue, 21 Apr 2020 08:14:09 +0000 (10:14 +0200)
Issue-ID: INT-1517
Signed-off-by: Edyta Krukowska <edyta.krukowska@nokia.com>
Change-Id: I1e65a3c0a1bb12d0809dc33a491b81d0b58fb324

netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/listener/KafkaListenerHandler.java

index 604315d..c3ce327 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,12 +22,9 @@ package org.onap.netconfsimulator.kafka.listener;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.kafka.core.ConsumerFactory;
-
 import org.springframework.kafka.listener.ContainerProperties;
 import org.springframework.kafka.listener.KafkaMessageListenerContainer;
 import org.springframework.kafka.listener.MessageListener;
-
-
 import org.springframework.kafka.support.TopicPartitionInitialOffset;
 
 import java.time.Instant;
@@ -46,12 +43,12 @@ public class KafkaListenerHandler {
     }
 
 
-    public KafkaListenerEntry createKafkaListener(MessageListener messageListener, String topicName) {
+    public KafkaListenerEntry createKafkaListener(MessageListener<String, String> messageListener, String topicName) {
         String clientId = Long.toString(Instant.now().getEpochSecond());
         ContainerProperties containerProperties = new ContainerProperties(topicName);
         containerProperties.setGroupId(clientId);
         KafkaMessageListenerContainer<String, String> listenerContainer = createListenerContainer(containerProperties,
-            topicName);
+                topicName);
 
         listenerContainer.setupMessageListener(messageListener);
         return new KafkaListenerEntry(clientId, listenerContainer);
@@ -59,9 +56,9 @@ public class KafkaListenerHandler {
 
 
     KafkaMessageListenerContainer<String, String> createListenerContainer(ContainerProperties containerProperties,
-        String topicName) {
+                                                                          String topicName) {
         TopicPartitionInitialOffset config = new TopicPartitionInitialOffset(topicName, PARTITION,
-            NUMBER_OF_HISTORICAL_MESSAGES_TO_SHOW, RELATIVE_TO_CURRENT);
+                NUMBER_OF_HISTORICAL_MESSAGES_TO_SHOW, RELATIVE_TO_CURRENT);
         return new KafkaMessageListenerContainer<>(consumerFactory, containerProperties, config);
     }
 }