Spring 云流 Kafka 消费者卡在长时间的 运行 工作和 max.poll.interval.ms 的大价值中

Spring cloud stream Kafka consumer stuck with long running job and large value for max.poll.interval.ms

我们有一些长期 运行 的工作也已通过 Spring Cloud Stream 和 Kafka binder 实现。我们面临的问题是因为 max.poll.interval.msmax.poll.records 的默认值不适合我们的用例,我们需要为 max.poll.interval.ms 设置一个相对较大的值(几个小时)并且max.poll.records 的相对较小的值(例如 1)与最长的 运行 作业保持一致可能会被消费者消耗。这解决了消费者进入再平衡循环的问题。然而,它给消费者带来了一些操作上的挑战。有时消费者会卡在重启过程中,并且在 max.poll.interval.ms 通过之前不会消费任何消息。

这是因为 Spring 云流轮询的实施方式吗?如果我使用同步消费者并相应地管理 poll() 是否有帮助?

消费者记录心跳丢失以及消费者卡住时我在Kafka日志中看到的消息:

GroupCoordinator 11]: Member consumer-3-f46e14b4-5998-4083-b7ec-bed4e3f374eb in group foo has failed, removing it from the group

Spring 云流(消息驱动)不适合此应用程序。自己管理消费者会更好;在 poll() 之后关闭它;处理工作;创建一个新的消费者并提交偏移量,然后再次 poll()