Spring Kafka, overriding max.poll.interval.ms?

Viewed 12096

I need to increase max.poll.interval.ms default value of 300000 to a greater value, due to. timeout exceptions.

However I am unable to find the property (autocomplete) in application.properties to override it. Am I missing something out? Or I'm just using an old version of Spring Kafka (2.1.10)

max.poll.interval.ms = 300000
max.poll.records     = 500
3 Answers

spring.kafka.consumer.properties.max.poll.interval.ms=20000000

It worked

There is an API, you have to set it manually. Read from the properties file and set it.

You can use consumer API to set the timeout. And configure that timeout in your property file. Consumer API provide following way to set poll duration.

    @Value("${pollDuration}")
    private Long pollDuration;   //read from property file

    ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(pollDuration));

Consumer provides the different type of arguments for poll method. You can use according to your requirement.

Related