How do I have RabbitMQ redeliver unacknowledged messages?

1,355 views
Skip to first unread message

phillip.ur...@gmail.com

unread,
Oct 9, 2017, 5:52:09 PM10/9/17
to rabbitmq-users

I'm following the following tutorial to the letter: https://www.rabbitmq.com/tutorials/tutorial-two-java.html.

I start the RabbitMQ server as such:


brew update
brew install rabbitmq
/usr/local/sbin/rabbitmq-server &

From the tutorial:

Using this code we can be sure that even if you kill a worker using CTRL+C while it was processing a message, nothing will be lost. Soon after the worker dies all unacknowledged messages will be redelivered.

I spawn two consumers, and when I CTRL+C one of them, the other running one does not receive the messages that were originally destined to the former consumer. How do I get the messages to be redelivered after CTRL+C'ing out of one of the consumers?


Michael Klishin

unread,
Oct 9, 2017, 7:04:20 PM10/9/17
to rabbitm...@googlegroups.com
Please see tutorial 2, http://www.rabbitmq.com/confirms.html and http://www.rabbitmq.com/heartbeats.html.

If a consumer is alive, closing its channel (or connection) will requeue all unacknowledged deliveries. Note that
peer going down is not immediately detected due to how TCP works — see the heartbeats guide above.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

phillip.ur...@gmail.com

unread,
Oct 11, 2017, 10:26:50 AM10/11/17
to rabbitmq-users
Thanks, Michael. So in the case of ungracefully killing the consumer process, the redelivery depends on the TCP socket timeout (short of heartbeat)?


On Monday, October 9, 2017 at 7:04:20 PM UTC-4, Michael Klishin wrote:
Please see tutorial 2, http://www.rabbitmq.com/confirms.html and http://www.rabbitmq.com/heartbeats.html.

If a consumer is alive, closing its channel (or connection) will requeue all unacknowledged deliveries. Note that
peer going down is not immediately detected due to how TCP works — see the heartbeats guide above.
On Mon, Oct 9, 2017 at 10:52 PM, <phillip.ur...@gmail.com> wrote:

I'm following the following tutorial to the letter: https://www.rabbitmq.com/tutorials/tutorial-two-java.html.

I start the RabbitMQ server as such:


brew update
brew install rabbitmq
/usr/local/sbin/rabbitmq-server &

From the tutorial:

Using this code we can be sure that even if you kill a worker using CTRL+C while it was processing a message, nothing will be lost. Soon after the worker dies all unacknowledged messages will be redelivered.

I spawn two consumers, and when I CTRL+C one of them, the other running one does not receive the messages that were originally destined to the former consumer. How do I get the messages to be redelivered after CTRL+C'ing out of one of the consumers?


--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Michael Klishin

unread,
Oct 16, 2017, 4:22:00 PM10/16/17
to rabbitm...@googlegroups.com
If a consumer process dies, it will take heartbeats (or TCP stack, via e.g. keepalive) to detect
that on the server end. Once that happens, RabbitMQ will consider the connection and all channels on it closed,
after which all unacknowledged messages will be requeued.

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages