[rabbitmq-discuss] Published message not queued after publish-ok received when connection quickly closed

Simon MacMullen simon at rabbitmq.com
Fri May 6 10:43:19 BST 2011

Hi Elias.

On 05/05/11 22:33, Elias Levy wrote:
> While writing some code using the Ruby AMQP gem against RabbitMQ, I've
> noticed that if I publish a message and quickly close the connection,
> even though I've received a publish-ok response from the server, the
> message fails to be queued by the broker.

I'm not at all familiar with the Ruby client, but I should point out 
that unlike many of the other AMQP methods, basic.publish does not have 
a corresponding basic.publish-ok method; it's always asynchronous. So I 
imagine the post-publish callback fires immediately.

In order to be able to know when the broker has taken responsibility for 
a message you can either wrap the publish in a transaction (when you see 
tx.commit-ok you know the server has the message) or use the rather more 
lightweight publish confirms:


...but I'm not sure if they are supported by the Ruby gem yet (Jakub, 
can you comment?)

Cheers, Simon

Simon MacMullen
Staff Engineer, RabbitMQ
SpringSource, a division of VMware

More information about the rabbitmq-discuss mailing list