Reputation: 13
For a consumer, when declaring a Queue to be 'exclusive', the Queue will be deleted when consumer disconnects per the documentation.
Assuming there are messages in the Queue awaiting processing and the consumer goes offline, all messages on this 'exclusive' Queue will be lost when Queue is removed.
Are there any strategies or ways to keep a Queue 'exclusive' but preserve the messages in the Queue/Broker so nothing is lost?
Thanks in advance.
Upvotes: 1
Views: 955
Reputation: 90447
Exclusive queue will be deleted when the channel created it disconnects.
What you probably want is exclusive consumer which can be done by setting exclusive
parameter to true when consume from a queue. Exclusive consumer ensures that only one consumer can consume this queue .It excludes all other consumers from the queue once it is consumed.
In summary , to make a queue exclusive to one consumer and persist the messages in this queue, you should :
Upvotes: 2