Spring Kafka listener using DeadLetterPublishingRecoverer and manual ack mode

末鹿安然 提交于 2019-12-05 14:27:52

I would try to avoid using manual acks if possible; perhaps by increasing max.poll.interval.ms instead.

If you use AckMode.MANUAL_IMMEDIATE, it will be safe to perform the commit directly on the Consumer in the error handler.

Subclass the SeekToCurrentErrorHandler and override handle(), If super.handle() doesn't throw an exception, it means the retries are exceeded and you can commit the offset on the Consumer.

commitRecovered can be set to true on SeekToCurrentErrorHandler instance being provided to the ContainerListenerFactory.

Refer documentation here

public void setCommitRecovered(boolean commitRecovered)

Set to true to commit the offset for a recovered record. The container must be >configured with ContainerProperties.AckMode.MANUAL_IMMEDIATE. Whether or not the >commit is sync or async depends on the container's syncCommits property.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!