[rabbitmq-discuss] detecting publish failure across restart

David Wragg david at rabbitmq.com
Mon May 31 14:21:57 BST 2010


Hi Jesse,

"jesse at wavemarket.com" <jesse at wavemarket.com> writes:
> I consistently see that the Java client sends some messages that do not
> cause an exception and that do not make into the queue. I have a registered
> ReturnListener, but it does not record any messages being returned.
>
> I understand that publishing a message is asynchronous, but surely there
> must be a way to discover that message was not successfully published. What
> am I missing?

This is almost certainly due to the issue that AMQP's basic.publish has
no corresponding response from the server to the client (at least, not
in the normal case).  Once a client has written the basic.publish
command otyo to the socket, it has done all it can.  So when you restart
RabbitMQ, the client has no way to know which publishes have been
recieved and processed by the server, and which are merely in
transmission (i.e. in the operating system's TCP socket buffer on the
client of server).

This lack of publish acks is often noted as a significant omission from
AMQP.

The workaroud is to use the transaction support in AMQP: Start a
transaction (with Channel.txSelect), do some publishes on the channel,
and then commit the transaction (with Channel.txCommit).  If the commit
completes successfully, you know that the publishes have taken place on
the server.

David

-- 
David Wragg
Staff Engineer, RabbitMQ
SpringSource, a division of VMware



More information about the rabbitmq-discuss mailing list