Category: RabbitMQ

How to customize the message in RabbitMQ while dead-lettering

When you are using Spring AMQP api to publish and consume the messages it provides the option to  consumer to Reject the message when we get AmqpRejectAndDontRequeueException.

Spring AMQP takes are of pushing the message to corresponding dead-letter exchange when this exception is occurred with status as Rejected.

But we don’t have any idea about which exception caused this particular message to be dead-letterd as spring amqp doesn’t provide it and it don’t have option to customize the message also.

Along with Spring-retry and spring AMQP api we can customize the message before its is dead-lettered.

Here is the sample Spring boot application,