[rabbitmq-discuss] Published message not queued after publish-ok received when connection quickly closed
Elias Levy
elevy at sourcefire.com
Thu May 5 22:33:49 BST 2011
Good day,
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.
The code in question looks like:
require 'amqp'
EM.run do
client = AMQP.connect(:host => '127.0.0.1')
channel = AMQP::Channel.new(client)
channel.on_error { puts 'channel error'; EM.stop }
exchange = channel.topic 'foo',:durable => true
exchange.publish( 'hello world', :routing_key => "some_topic", :persistent
=> true, :nowait => false ) { puts 'publish-ok'; EM.stop }
end
I should clarify that there is a binding in place to route messages with
routing_key "some_topic" to the a queue on the "foo" exchange.
If I remove the EM.stop call in the publish-ok callback, allowing the
connection to exist after the publish, then I the message is queued.
Is this expected behavior?
I would expect that if the broker has responded with a publish-ok, then
regardless of what happens to the connection from that point forward, it
will do its best to deliver that message to a queue.
--
*Elias Levy*
Fellow, Technical Research Group
SourceFire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110505/c4caa36d/attachment.htm>
More information about the rabbitmq-discuss
mailing list