Skip to content

Commit

Permalink
Using auto commit interval config via properties
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik-tarento authored Nov 10, 2022
1 parent 36fc315 commit 886f0d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ConcurrentMessageListenerContainer<String, String>> kafkaListenerContainerFactory() {
Expand All @@ -52,7 +54,7 @@ public Map<String, Object> 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);
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 886f0d0

Please sign in to comment.