如果存在servicedown异常,则KafkaMessageListenerContainer重新处理消息 [英] KafkaMessageListenerContainer reprocess a message if there is servicedown exception
问题描述
我们希望以某种方式配置Spring Kafka侦听器,以便在任何外部服务出现故障的情况下,我们都不希望丢失从Kafka接收到的消息.我们希望将其还原,直到成功处理为止.
We want to have a Spring Kafka listener configured in such a way that if any external service is down we don't want to loose the message that's consumed from Kafka. we want to revert it back till it is successfully processed.
请帮助我进行配置以达到相同的效果.
could you please help with the configuration that I can use to achieve the same.
如果我批量使用该消息,该如何处理.
How can I handle it if I consume the message in batches.
我们正在使用Kafka 0.9
We are using Kafka 0.9
推荐答案
I think Retry best fits to your requirements:
要重试传递,提供了方便的侦听器适配器-
RetryingMessageListenerAdapter
和RetryingAcknowledgingMessageListenerAdapter
,具体取决于您使用的是MessageListener
还是AcknowledgingMessageListener
.
To retry deliveries, convenient listener adapters -
RetryingMessageListenerAdapter
andRetryingAcknowledgingMessageListenerAdapter
are provided, depending on whether you are using aMessageListener
or anAcknowledgingMessageListener
.
这篇关于如果存在servicedown异常,则KafkaMessageListenerContainer重新处理消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!