Dead Lettering messages on queue deletion

631 views
Skip to first unread message

John Robert

unread,
Apr 10, 2015, 5:46:58 AM4/10/15
to rabbitm...@googlegroups.com
Hi,


Messages in a deleted queue should be sent to the dead letter exchange:

Delete a queue.

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.


Unfortunately, I'm unable to achieve this behaviour.

Is this a mistake in the documentation?

Is this a mistake in the setting I'm using?
(
I've done a lot of tests, but basically, setting is done this way
 - create a dead letter queue DLQ
 - create a direct exchange "DLX"
 - bind DLX to DLQ
 - create a SingleQueue with x-dead-letter-exchange: "DLX"
 - post a message 
 - delete the queue
=> message isn't sent to DLQ
=> if queue is configured with TTL, elapsed message are indeed sent to DLQ
)

Documentation says "if this is defined in the server configuration", but I didn't find any parameter related to dead lettering messages of deleted queues... have I missed something?



To get back to the roots of this question, here's in fact, the problem I'm trying to solve:
 - in a setup with really unstable connections
 - a single unstable client has it's own unique, named queue 
 - when this single client looses its connection to the broker, it creates a new connection and channel, than listen to the same single queue
 - but as previous connection hasn't been closed nicely, RabbitMQ think he has two consumer on this single queue and load balance messages between zombie pending connection and the new active connection

I tried to solve the problem by deleting the queue after new connection is established, but this way, pending messages are lost. If dead lettering of deleted queue isn't possible with RabbitMQ, maybe there's a more natural way to solve the problem?


Thanks in advance for your answers,
Regards,
John R.



John Robert

unread,
Apr 10, 2015, 6:14:00 AM4/10/15
to rabbitm...@googlegroups.com
Partial answer to this question seems to be available in page:


server queue / delete / 01
SHOULD => doesn't
The server SHOULD use a dead-letter queue to hold messages that were pending on a deleted queue, and MAY provide facilities for a system administrator to move these messages back to an active queue.

It this exact, RabbitMQ doesn't dead letter messages of deleted queues... so second part of my post remains open... what is the natural way to solve the problem described in the end of the post?

Regards,
John R. 

Jean-Sébastien Pédron

unread,
Apr 10, 2015, 6:36:10 AM4/10/15
to rabbitm...@googlegroups.com
On 10.04.2015 12:14, John Robert wrote:
> It this exact, RabbitMQ doesn't dead letter messages of deleted
> queues...

Hi!

Yes, this is true. This feature was discussed a couple times in the
past. This requires very careful thoughts and is non-trivial to
implement. See this recent comment from Simon, and the linked post:

https://github.com/rabbitmq/rabbitmq-server/pull/29#issuecomment-83619236

> so second part of my post remains open... what is the natural
> way to solve the problem described in the end of the post?

AFAIK, the only solution is to do that from a client (ie. consume the
entire queue and requeue on the DLX). You will face some of the problems
mentionned in the discussion linked above.

--
Jean-Sébastien Pédron
Pivotal / RabbitMQ

John Robert

unread,
Apr 10, 2015, 6:51:49 AM4/10/15
to rabbitm...@googlegroups.com, jean-se...@rabbitmq.com
Hi,

Thanks for the confirmation of this information.

I understand that this function is not trivial and not yet available nor planned.

Because of  the context (unreliable network, half closed/zombie connection, tcp closing timeout, etc.), I can't rely on suggested client scenario :-/.

If there's no other elegant solution, I may implement this at application level by having producer buffer and reemit unacknowledged messages (I can rely on an application level ack mechanism).

Regards,
John R.
Reply all
Reply to author
Forward
0 new messages