[rabbitmq-discuss] Consistent Exchange Only if Consumers?

Emile Joubert emile at rabbitmq.com
Tue Feb 19 10:28:02 GMT 2013


Hi François,

On 16/02/13 02:31, François Beausoleil wrote:
> Is there a knob somewhere to make x-consistent-hash exchanges deliver
> only to queues that have an active consumer?

No. You might find references to the basic.publish "immediate" flag,
which has been removed in recent versions of RabbitMQ, so don't use that.

http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish.immediate

> I chose to use exclusive queues for the consumers, so if the consumer
> crashes, messages will be rerouted. Problem is, if the consumer
> crashes, the messages are lost.

If messages were sent to a queue that still exist then they are not
really lost.

> on consumer crash, if the queue could redeliver the messages to the
> origin exchange, then I would be all right as well.

You could consider using auto-delete queues together with dead-letter
exchanges to make sure that messages are no longer routed to queues that
belonged to consumers that crashed, and that any messages left in such
queues are available for processing.

http://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare.auto-delete
http://www.rabbitmq.com/dlx.html

> My problem is really with the messages that are in the queue when a
> consumer crashes.

Either make sure that the queues no longer exist when consumers crash,
or make sure that consumers reconnect to the same queues when they recover.





-Emile





More information about the rabbitmq-discuss mailing list