[英]Spring Kafka, overriding max.poll.interval.ms?
I need to increase max.poll.interval.ms default value of 300000 to a greater value, due to.我需要将max.poll.interval.ms默认值 300000 增加到更大的值,因为。 timeout exceptions.
超时异常。
However I am unable to find the property (autocomplete) in application.properties to override it.但是我无法在 application.properties 中找到属性(自动完成)来覆盖它。 Am I missing something out?
我错过了什么吗? Or I'm just using an old version of Spring Kafka (2.1.10)
或者我只是使用旧版本的 Spring Kafka (2.1.10)
max.poll.interval.ms = 300000
max.poll.records = 500
spring.kafka.consumer.properties.max.poll.interval.ms=20000000 spring.kafka.consumer.properties.max.poll.interval.ms=20000000
It worked有效
You can use consumer API to set the timeout.您可以使用消费者 API 来设置超时。 And configure that timeout in your property file.
并在您的属性文件中配置该超时。 Consumer API provide following way to set poll duration.
消费者 API 提供以下方式来设置轮询持续时间。
@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.消费者提供不同类型的 arguments 用于轮询方法。 You can use according to your requirement.
您可以根据自己的要求使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.