@RabbitListener(queues="XYZ")
public void rabbitMsgReceiver(@Payload final UserProfile up, Message msg, Channel channel) {
}
If the message that is received is not a valid JSON of UserProfile
, then ListenerExecutionFailedException
occurs and the message goes to the
unack state. How can I send the message into the dead letter queue?
You can configure a dead letter queue policy in order to send unacked message to dlq instead of putting them to the original queue
https://www.rabbitmq.com/dlx.html#using-policies
example for your queue XYZ, suppose your set XYZ-dlq for it :