I have a rabbit queue with messages for consuming. I also have a listener that can fail. The queue is configured with a dead letter exchange (along with a dead letter queue). What I want is to see an exception info in the messages sitting in the dead letter queue.
Here is how it works currently:
- I send a corrupted message to my normal queue.
- My listener (I'm using Java's org.springframework.amqp.core.MessageListener) fails with something like: "java.lang.RuntimeException: corrupted message"
- The message gets rejected and goes to the dead letter queue thru the dead letter exchange.
- When I look at the dead-lettered message in the Rabbit Admin UI, I see:
headers:
x-death:
reason: rejected
But what I want is to see the "java.lang.RuntimeException: corrupted message" somewhere on UI. I assume it should be a custom header?
Is it possible to, for example, put a general try-catch to my listener and enhance the headers with the exception info?