[rabbitmq-discuss] Hash Exchange with temporary queues
Emile Joubert
emile at rabbitmq.com
Fri Apr 19 14:10:18 BST 2013
Hi,
On 17/04/13 18:21, sinsei wrote:
> The problem I've noticed is that when I shut down a consumer, some messages
> are just lost. I wasn't sure how to set this up as dead-letter-exchanges
> won't work for this case. Is there a way I can ensure those messages are
> passed somewhere else?
The consistent hash exchange is not ideal in cases where queues are
deleted and message loss cannot be tolerated. The documentation makes
clear that messages are delivered to at most one queue. Message loss can
only be prevented by not deleting queues.
It is possible to reduce the chances of message loss: instead of relying
on auto-deletion, consumers could use the if-empty flag of the
queue.delete method to delete their queue prior to shutting down.
Unfortunately this process is not guaranteed to ever complete, because a
new message may have arrived by the time processing of the last one
completes
> Also, what happens if I have no consumers, it appears the messages are just
> gone. I may have to set up an alternative exchange?
Yes, or use the mandatory publishing flag:
http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish.mandatory
> I've also considered adding some grouping as a plugin so I could have a
> single durable, trunk queue, but I'm unsure if it is possible with the
> current plugin model.
It is possible to create custom exchange and queue implementations as
plugins. The potential for messages en route to a disappearing queue to
be lost will exist regardless of queue implementation.
More information about the rabbitmq-discuss
mailing list