From 886f0d0dd9cb420aaad379ff3c54e56a40e1f233 Mon Sep 17 00:00:00 2001 From: Karthikeyan Rajendran <70887864+karthik-tarento@users.noreply.github.com> Date: Thu, 10 Nov 2022 11:40:05 +0530 Subject: [PATCH] Using auto commit interval config via properties --- .../java/org/sunbird/core/config/ConsumerConfiguration.java | 4 +++- src/main/resources/application.properties | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sunbird/core/config/ConsumerConfiguration.java b/src/main/java/org/sunbird/core/config/ConsumerConfiguration.java index da01a30cd..ec6faacd6 100644 --- a/src/main/java/org/sunbird/core/config/ConsumerConfiguration.java +++ b/src/main/java/org/sunbird/core/config/ConsumerConfiguration.java @@ -29,6 +29,8 @@ public class ConsumerConfiguration { @Value("${kafka.max.poll.records}") private Integer kafkaMaxPollRecords; + @Value("${kafka.auto.commit.interval.ms}") + private Integer kafkaAutoCommitInterval; @Bean KafkaListenerContainerFactory> kafkaListenerContainerFactory() { @@ -52,7 +54,7 @@ public Map consumerConfigs() { propsMap.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkabootstrapAddress); propsMap.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true); propsMap.put(ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG, "1000"); - propsMap.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000"); + propsMap.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, kafkaAutoCommitInterval); propsMap.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, "15000"); propsMap.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); propsMap.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f73438235..d67d4a82e 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -88,8 +88,9 @@ spring.kafka.bootstrap.servers=localhost:9092 #kafka properties kakfa.offset.reset.value=latest -kafka.max.poll.interval.ms=5000 +kafka.max.poll.interval.ms=15000 kafka.max.poll.records=100 +kafka.auto.commit.interval.ms=10000 org.create.endpoint=v1/org/create