KafkaMessageListenerContainer在servicedown异常时重新处理消息 [英] KafkaMessageListenerContainer reprocess a message if there is servicedown exception

查看:41
本文介绍了KafkaMessageListenerContainer在servicedown异常时重新处理消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们希望以这样的方式配置 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:

为了重试传递,提供了方便的侦听器适配器 - RetryingMessageListenerAdapterRetryingAcknowledgingMessageListenerAdapter,具体取决于您使用的是 MessageListener 还是 >确认消息监听器.

To retry deliveries, convenient listener adapters - RetryingMessageListenerAdapter and RetryingAcknowledgingMessageListenerAdapter are provided, depending on whether you are using a MessageListener or an AcknowledgingMessageListener.

这篇关于KafkaMessageListenerContainer在servicedown异常时重新处理消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆