Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override property in spring boot kafka project

How can i add/override max.poll.interval.ms and max.poll.records in my .yml file in spring boot Kafka micro-service project

What i tried is but it does not work

Kafka:
 consumer: 
  max-poll-records: 200
  max-poll-interval-ms: 600000ms
like image 657
LearnThings Avatar asked Sep 14 '25 21:09

LearnThings


1 Answers

Must be like this:

spring:
  kafka:
    consumer:
      max-poll-records: 200
      properties:
        max.poll.interval.ms: 600000

See Spring Boot docs: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#messaging.kafka.additional-properties

The max.poll.interval.ms is not exposed into KafkaProperties, therefore its original name from the ConsumerConfig has to be used under that properties section. Note: you also cannot use ms since Temporal conversion is only done for exposed properties.

like image 83
Artem Bilan Avatar answered Sep 17 '25 12:09

Artem Bilan