Reputation: 3377
I have an a queue that has x-expires
set. The issue I am having is that I need to do further processing on the messages that are in the queue IF the queue expires. My initial idea was to set x-dead-letter-exchange
on the queue. But, when the queue expires, the messages just vanish without making it to the dead-letter exchange.
How can I dead-letter, or otherwise process, messages that are in a queue that expires?
Upvotes: 2
Views: 1655
Reputation: 438
As suggested in the comments, you cannot do this by relying only on the x-expire
feature. But a solution that worked in a similar case I had was to:
x-message-ttl
to make sure messages die if not consumed in a timely manner,x-expires
to set the queue expiration to a value higher than the TTL of the messages,This way the messages that were published before the last consumer died were already processed, existing messages will be dead-lettered before the queue expires, and new messages cannot come into the queue.
Upvotes: 1
Reputation: 1989
You need to add a new dead letter queue that is bound to your dead letter exchange with the binding routing key set as the original queue name. In this way all expired messages sent to the dead letter exchange are routed to the dead letter queue.
Upvotes: 0