本文介绍了Kafka 手动 ackMode MANUAL_IMMEDIATE 如果不确认怎么办的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Spring kafKa anf 我将 ackMode 设置为 MANUAL_IMMEDIATE

I use Spring KafKa anf I set ackMode to MANUAL_IMMEDIATE

props.setAckMode(AbstractMessageListenerContainer.AckMode.MANUAL_IMMEDIATE);

情况是,由于某种原因,我的应用无法确认 (acknowledgment.acknowledge()) 并且无一例外地错过了它.

the scenario is that for some reason my app could not acknowledge (acknowledgment.acknowledge()) and just miss it without exception.

1- 如何为错过的消息设置消费者重试2- 如何配置在达到我配置的最大重试次数后调用函数

1- How can I set consumer retry for missed message2- How configure to call a function after max retry count that I configured reached

推荐答案

参见 有关SeekToCurrentErrorHandlers 的文档.

See the documentation about SeekToCurrentErrorHandlers.

当侦听器抛出异常时,错误处理程序将执行必要的查找并重新获取记录.您可以设置放弃前的尝试次数.

When the listener throws an exception, the error handler will perform the necessary seeks and re-fetch the record. You can set the number of attempts before giving up.

还有一个DeadLetterPublishingRecoverer 可用于将失败的记录发送到另一个主题.

There is also a DeadLetterPublishingRecoverer which can be used to send the failed record to another topic.

这篇关于Kafka 手动 ackMode MANUAL_IMMEDIATE 如果不确认怎么办的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 02:44