[rabbitmq-discuss] Publisher confirms when the unexpected happens
chris.d at frugalit.co.uk
Sat Jan 12 11:59:38 GMT 2013
I am publishing persistent messages which get routed via a durable
direct exchange to a durable queue. The channel that I'm using is in
confirmation mode. There are no consumers subscribed to the queue.
What I would like to understand is what happens if my publisher loses
its AMQP connection and channels after it has sent all of its messages
but before it can receive any confirmations. I'm testing this in two ways:
1. My publisher sends its messages and then exits immediately.
2. My publisher sends its messages, closes the connection/channels in a
controlled manner and then exits.
No. 2 above always results in all of the messages appearing in the
target queue. I don't have any issues with this behaviour.
However, when I perform No. 1 above, I am observing inconsistent
behaviour. Sometimes all of the messages appear in the target queue, but
at other times only some of the messages appear. There are always some
messages in the queue - never zero.
In the case of No. 1 above, I have observed that when I run my script
and only some messages appear in the queue, the last TCP frame sent to
RabbitMQ always contains multiple AMQP basic.publish framesets. Every
time that the last TCP frame sent contains a single AMQP basic.publish
frameset, all messages appear in the target queue. This may have no
bearing on what's happening in RabbitMQ, but the results are always
predictable based on what I'm seeing going across the wire using Wireshark.
What I was hoping for was an 'all or nothing' outcome for No. 1 as in
No. 2. So what I'd like to know is - is the behaviour that I'm seeing
expected from a RabbitMQ point of view?
If anybody wants to run my publisher code then it's here -
My test environments are using Ubuntu 12.04 LTS 32 and 64-bit, Erlang
R14B04, Ruby gem Bunny 0.9.0.pre5 and Ruby 1.9.3-p362. The Bunny gem can
be installed by running -
gem install bunny --pre
More information about the rabbitmq-discuss