From c109ebec4a58f65d0532ca052835e993c4a1273a Mon Sep 17 00:00:00 2001 From: mpriyank Date: Tue, 6 Feb 2024 10:44:14 +0000 Subject: [BUG] Retry interval for kafka consumer - added retry interval of 10 seconds in case of any auth exception when consuming kafka messages. - This fix prevents us from restarting the whole app inorder to restart the consumer. Issue-ID: CPS-2070 Change-Id: Ie02d3cb686741cd92dd006dab1d49c3480d58720 Signed-off-by: mpriyank --- .../main/java/org/onap/cps/ncmp/api/impl/config/kafka/KafkaConfig.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cps-ncmp-service/src') diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/kafka/KafkaConfig.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/kafka/KafkaConfig.java index 514967574f..4f2674aca3 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/kafka/KafkaConfig.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/kafka/KafkaConfig.java @@ -21,6 +21,7 @@ package org.onap.cps.ncmp.api.impl.config.kafka; import io.cloudevents.CloudEvent; +import java.time.Duration; import java.util.Map; import lombok.RequiredArgsConstructor; import org.apache.kafka.clients.producer.ProducerConfig; @@ -99,6 +100,7 @@ public class KafkaConfig { final ConcurrentKafkaListenerContainerFactory containerFactory = new ConcurrentKafkaListenerContainerFactory<>(); containerFactory.setConsumerFactory(legacyEventConsumerFactory()); + containerFactory.getContainerProperties().setAuthExceptionRetryInterval(Duration.ofSeconds(10)); return containerFactory; } @@ -150,6 +152,7 @@ public class KafkaConfig { final ConcurrentKafkaListenerContainerFactory containerFactory = new ConcurrentKafkaListenerContainerFactory<>(); containerFactory.setConsumerFactory(cloudEventConsumerFactory()); + containerFactory.getContainerProperties().setAuthExceptionRetryInterval(Duration.ofSeconds(10)); return containerFactory; } -- cgit 1.2.3-korg