简体   繁体   English

Spring Kafka,覆盖 max.poll.interval.ms?

[英]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有效

There is an API , you have to set it manually.有一个API ,你必须手动设置它。 Read from the properties file and set it.从属性文件中读取并设置它。

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.

相关问题 Spring 云 stream 卡夫卡消费者卡在长时间运行的作业和 max.poll.interval.ms 的大值 - Spring cloud stream Kafka consumer stuck with long running job and large value for max.poll.interval.ms Kafka poll 和 max.poll.interval.ms - 批处理最佳实践 - Kafka poll and max.poll.interval.ms - Batch Processing best practices 如何知道在 java kafka 应用程序客户端中是否达到了 max.poll.interval.ms? - How to know if max.poll.interval.ms is reached in java kafka application client? 更改Kafka配置max.poll.interval.ms导致一名消费者卡在(重新)加入组中 - Change Kafka configuration max.poll.interval.ms causes one consumer stuck at (Re-)joining group 为指定主题配置max.poll.interval.ms - Configure max.poll.interval.ms for a specified topic 在 Kafka 消费者配置中将 max.poll.interval.ms 设置为大于 request.timeout.ms 的负面影响是什么 - What is negative effects of setting max.poll.interval.ms larger than request.timeout.ms in Kafka consumer configs Consumer CommitFailedException - 后续调用 poll() 之间的时间长于配置的 max.poll.interval.ms - Consumer CommitFailedException - time between subsequent calls to poll() was longer than the configured max.poll.interval.ms Kafka Connect SourceTask 的轮询间隔 - Poll Interval for Kafka Connect SourceTask Apache Kafka-了解在poll()方法中作为参数存在的超时与fetch.max.wait.ms之间的关系 - Apache Kafka- Understanding the relationship between timeout present as a parameter in the poll() method and fetch.max.wait.ms 当Kafka消费者不使用订阅方法时,是否检查session.timeout.ms或max.pool.interval.ms? - When Kafka consumer don't use subscribe method, do it check session.timeout.ms or max.pool.interval.ms?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM