简体   繁体   English

死信队列中邮件标头中的异常跟踪

[英]Trace of exception in message header on dead letter queue

I am using spring-cloud-stream to consume message from Rabbit MQ. 我正在使用spring-cloud-stream消费Rabbit MQ的消息。 I have a queue and dead-letter-queue binding to it. 我有一个队列和死信队列绑定到它。 Whenever there is any exception, messages are getting routed to dead-letter-queue. 每当有任何异常时,邮件就会被路由到死信队列。

My question is - Can we put a header in message with Exception class before receiving it on dead letter queue. 我的问题是- 我们可以在死信队列中接收标头之前,先将其标头放入具有Exception类的消息中。 Or, how do we know which exception occurred by looking at the message. 或者,通过查看消息我们如何知道发生了哪个异常。 I would like to repair, re queue or park the messages based on exception. 我想根据例外情况修复,重新排队或存放邮件。

You cannot modify the rejected message when it is sent to the DLQ by RabbitMQ itself; 当RabbitMQ自身将拒绝的消息发送到DLQ时,您无法修改该消息; for that reason the binder provides a consumer property republishToDlq where, instead of the rejecting the message and having RabbitMQ send it to the DLQ, the binder itself publishes it there, and adds headers with exception information etc. 出于这个原因,绑定器提供了一个消费者属性republishToDlq ,其中绑定器本身将其republishToDlq在其中,而不是拒绝消息并让RabbitMQ将其发送到DLQ,并在其中发布并添加带有异常信息的标头等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM