gpt4 book ai didi

java - 在 Kafka 重新平衡中,撤销操作是否会等待消费进程完成?

转载 作者:行者123 更新时间:2023-11-30 05:44:14 25 4
gpt4 key购买 nike

例如,如果我的 KafkaConsumer 中有一个长时间运行的进程。 (假设需要 1 小时才能完成。)如果触发重新平衡,该消费者的撤消操作是否要等到该消费者消费(处理)已经开始处理的消息后才重新平衡?

那么有可能只是因为这种重新平衡需要太多时间吗?

或者撤销操作立即完成?

最佳答案

对于新的 Java 消费者,重新平衡的默认时间为 5 分钟,在重新平衡代理从组中删除该消费者并调用重新平衡之前,它只会删除该线程,但不会终止(因此消费者将处理它的所有记录)开始,完成后就会死掉)

如果在 session 超时到期之前代理没有收到心跳,则代理将从组中删除该消费者并启动重新平衡。

如果在此超时到期之前未调用 poll(),则消费者被视为失败,组将重新平衡,以便将分区重新分配给另一个成员。

The new Java Consumer now supports heart beating from a background thread. There is a new configuration max.poll.interval.ms which controls the maximum time between poll invocations before the consumer will proactively leave the group (5 minutes by default). The value of the configuration request.timeout.ms must always be larger than max.poll.interval.ms because this is the maximum time that a JoinGroup request can block on the server while the consumer is rebalancing, so we have changed its default value to just above 5 minutes.

关于java - 在 Kafka 重新平衡中,撤销操作是否会等待消费进程完成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55128082/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com