We'd like to use exclusive queues, but we do not want to lose any messages in case our consumer crashes. I thought the dead-letter mechanism would be a good solution for this: when our application unexpectedly crashes, all the exclusive queues that are used by the application will then automatically be removed (which is good), and the messages in these queues are dead-lettered to a special dead-letter queue where they can later be picked up and be further processed.
However, it turns out that dead-lettering does not work that way. When the application is killed, the queues are indeed removed, but the messages in these queues are lost as well. They are not dead-lettered.
Another (possibly related) issue: according to the online documentation (https://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.delete) the queue.delete function should do the following:
"This method deletes a queue. When a queue is deleted any pending messages are sent to a dead-letter queue if this is defined in the server configuration, and all consumers on the queue are cancelled."
This does not seem to happen. When I explicitly remove an exclusive (possibly true for non-exclusive queues as well) queue, the pending messages are not sent to the dead letter queue or dead letter exchange, but they are lost.
A work-around for our software that I now can think of is using non-exclusive queues, so that the queues will not be removed when the application crashes or gets killed. For this work-around we will have to find out which queues were active at the time the previous program crashed, so that they can be picked up by the restarted process. There is as far as I know no AMQP call to retrieve all active queues, or is there?
1. The documentation of the queue.delete function says that pending messages are dead-lettered, but they are (as far as I know) not.
2. An exclusive queue that gets deleted because of a broken connection does not dead-letter its messages (although it would be very convenient if it did)
3. Is there any way how we can find out which queues are still active, so that a restarted process can recover from an earlier crash or kill?