summaryrefslogtreecommitdiffstats
path: root/netconfsimulator/src
diff options
context:
space:
mode:
authoredyta <edyta.krukowska@nokia.com>2020-04-21 10:14:09 +0200
committeredyta <edyta.krukowska@nokia.com>2020-04-21 10:14:09 +0200
commiteac5ff61f954cdbda1258de46a1ddca381c76325 (patch)
treea4afdcff57378f4fbb711c21b026e8fa5ff35a37 /netconfsimulator/src
parent245f62cd9e2a0ced2be03e5fff04fa86ea505596 (diff)
Fix sonar issue KafkaListenerHandler
Issue-ID: INT-1517 Signed-off-by: Edyta Krukowska <edyta.krukowska@nokia.com> Change-Id: I1e65a3c0a1bb12d0809dc33a491b81d0b58fb324
Diffstat (limited to 'netconfsimulator/src')
-rw-r--r--netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/listener/KafkaListenerHandler.java15
1 files changed, 6 insertions, 9 deletions
diff --git a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/listener/KafkaListenerHandler.java b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/listener/KafkaListenerHandler.java
index 604315d..c3ce327 100644
--- a/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/listener/KafkaListenerHandler.java
+++ b/netconfsimulator/src/main/java/org/onap/netconfsimulator/kafka/listener/KafkaListenerHandler.java
@@ -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);
}
}