简体   繁体   中英

Trace of exception in message header on dead letter queue

I am using spring-cloud-stream to consume message from 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. 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; 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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