In the case that the message was actually dead-lettered, you can check the contents of the x-death
message header.
This would for example be the case when you reject
/nack
with requeue = false
and the queue has an associated dead letter exchange.
In that case, the contents of this header is an array. Each element describes a failed delivery attempt, containing information such as the time it was attempted delivered, routing information, etc.
This works for RabbitMQ - I don't know if it is applicable to AMQP in general.
EDIT
Since I originally wrote this answer, the x-death
header structure has been changed.
It is generally a very bad thing that headers changes format, but
in this particular case the reason was that the message size would grow indefinitely if the message was continuously dead-lettered.
I have therefore removed the piece of code that used to be here to get the no of deaths for a message.
It is still possible to get the number of deaths from the new header format.