简体   繁体   English

如何知道在 java kafka 应用程序客户端中是否达到了 max.poll.interval.ms?

[英]How to know if max.poll.interval.ms is reached in java kafka application client?

Is there an exception thrown somewhere when kafka max.poll.interval.ms is reached and rebalance happens?当达到 kafka max.poll.interval.ms并发生重新平衡时,是否会在某处引发异常?

Once your consumer gets kicked out of the consumer group due to long poll() , you will receive a CommitFailedException .一旦你的消费者由于长poll()被踢出消费者组,你将收到一个CommitFailedException According to the documentation :根据文档

It is also possible that the consumer could encounter a "livelock" situation where it is continuing to send heartbeats, but no progress is being made.消费者也有可能遇到“活锁”情况,它继续发送心跳,但没有取得任何进展。 To prevent the consumer from holding onto its partitions indefinitely in this case, we provide a liveness detection mechanism using the max.poll.interval.ms setting.为了防止消费者在这种情况下无限期地持有其分区,我们提供了一种使用max.poll.interval.ms设置的活动检测机制。 Basically if you don't call poll at least as frequently as the configured max interval, then the client will proactively leave the group so that another consumer can take over its partitions.基本上,如果您没有像配置的最大间隔那样频繁地调用 poll,那么客户端将主动离开组,以便另一个消费者可以接管其分区。 When this happens, you may see an offset commit failure (as indicated by a CommitFailedException thrown from a call to commitSync() ).发生这种情况时,您可能会看到偏移提交失败(如调用commitSync()时抛出的CommitFailedException所示)。 This is a safety mechanism which guarantees that only active members of the group are able to commit offsets.这是一种安全机制,可确保只有组中的活跃成员才能提交偏移量。 So to stay in the group, you must continue to call poll.所以要留在群里,你必须继续调用poll。


Therefore, you could possibly catch CommitFailedException .因此,您可能会捕获CommitFailedException Actually, you can keep calling poll() until re-balancing is complete and your consumer re-enters the consumer group.实际上,您可以继续调用poll()直到重新平衡完成并且您的消费者重新进入消费者组。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring Kafka,覆盖 max.poll.interval.ms? - Spring Kafka, overriding max.poll.interval.ms? Kafka poll 和 max.poll.interval.ms - 批处理最佳实践 - Kafka poll and max.poll.interval.ms - Batch Processing best practices 更改Kafka配置max.poll.interval.ms导致一名消费者卡在(重新)加入组中 - Change Kafka configuration max.poll.interval.ms causes one consumer stuck at (Re-)joining group Spring 云 stream 卡夫卡消费者卡在长时间运行的作业和 max.poll.interval.ms 的大值 - Spring cloud stream Kafka consumer stuck with long running job and large value for max.poll.interval.ms 为指定主题配置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 Kafka:阻止读取但不轮询的Java客户端 - Kafka: Java client that blocks read and doesn't poll kafka java 客户端不消费 - 只是挂在 consumer.poll 上 - kafka java client not consuming - just hangs at consumer.poll
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM