[rabbitmq-discuss] How to ensure the message delivery using shared queues

Rob Harrop rob at rabbitmq.com
Thu Oct 14 15:19:41 BST 2010


For your queue setup you should make sure that you are creating a durable queue. If the queue is not durable it will just disappear when the server is restarted.

On the publish side, you want to make sure that you set delivery mode to 2 (persistent). By default, delivery mode is set to 1 (transient). In Java this looks like:

	AMQP.BasicProperties props = new AMQP.BasicProperties();

	channel.basicPublish("amq.direct", "test", props, "test".getBytes());

You might want to do your publish transactionally to be certain that the messages have been written to disk. Once you get back tx.commit_ok you can be sure that persistent messages published in that transaction are written to disk.

On the consume side, you can work with noAck=false and only acknowledge the messages when they are successfully processed. 

If a Channel closes without acknowledging a message that has been delivered to it for a given queue, then that message will be redelivered to another consumer on that queue.

I hope this helps. Let me know if you need any more detail.


On 11 Oct 2010, at 12:13, padl wrote:

> hi
> I am a novice user. I just want to know when we use shared queue how to
> ensure the delivery and durability of message?
> Any help will be appreciable.
> Thank You
> -- 
> View this message in context: http://old.nabble.com/How-to-ensure-the-message-delivery-using-shared-queues-tp29933060p29933060.html
> Sent from the RabbitMQ mailing list archive at Nabble.com.
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

More information about the rabbitmq-discuss mailing list