Is there a way to ensure when you NACK a message and it gets sent to a dead letter exchange/queue that it will be persistent? It seems by default even if the original message is set as persistent with SetPersistent(true), the dead lettered message does not follow suite.
1
votes
is there a reason not to just set the entire dead-letter queue as persistent?
– jhilden
Is that an option? So far I have only found that you can set the persistence on the message level. Since rabbit handles the dead letter publish, I can't find a way for it to set the persistent bit in the BasicProperties ( delivery_mode = 2).
– Deofol
Yes, you can make a whole queue persistent. The term Rabbit uses is "Durable". It means the queue will survive a rabbit and/or server shutdown
– jhilden
Not exactly, durability is for the queue configuration only; not the messages in it. If you add messages without a delivery_mode = 2 (or SetPersistent(true) in the .net client) when the service is restarted or crashes, all messages in the queue are lost. I have verified this behavior. The problem is rabbit does not write the dead letter messages with the same persistence as the original message. So a service restart will drop all messages in the dead queue.
– Deofol
If the message is tag as persistent and the DLQ tag as durable, the message should be persisted. Tested using RabbitMQ 3.5
– Nicolas Labrot
1 Answers
1
votes
RabbitMQ doesn't modify the properties of Dead Letter'ed messages, except for the expiration one: https://github.com/rabbitmq/rabbitmq-server/blob/master/src/rabbit_dead_letter.erl#L74
If the message was published with deliver_mode=2, then it should be published as persistent into the Dead Letter Queue