[英]AmqpItemReader and Dead Letter Queue
I'm trying to implement a job that reads messages from a queue and move them to dead letter when an error occurs. 我正在尝试实现一个从队列中读取消息的作业,并在发生错误时将它们移动到死信。 I've tried to use a transacted channel but it always requeue the message.
我试图使用事务处理频道,但它总是重新排列邮件。
Is there any automatic way to do that with Spring Batch when an exception is thrown? 当抛出异常时,是否有任何自动方法可以使用Spring Batch执行此操作?
Please, refer to Spring AMQP about Dead Lettering . 请参考Spring AMQP关于死亡刻字 。
There is RejectAndDontRequeueRecoverer
which you can inject into the RabbitTemplate
for the AmqpItemReader
. 有
RejectAndDontRequeueRecoverer
,你可以为RabbitTemplate
注入AmqpItemReader
。 So, all those .receive()
will be wrapped with the retry advice and in case of exhausting the message will be rejected to the configured DLX. 因此,所有这些
.receive()
都将包含重试建议,如果耗尽消息,将被拒绝配置的DLX。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.