Good day,<div><br></div><div>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.</div>
<div><br></div><div>The code in question looks like:</div><div><br></div><div><div>require 'amqp'</div><div>EM.run do</div><div> client = AMQP.connect(:host => '127.0.0.1')</div><div> channel = AMQP::Channel.new(client)</div>
<div> channel.on_error { puts 'channel error'; EM.stop }</div><div> exchange = channel.topic 'foo',:durable => true</div><div> exchange.publish( 'hello world', :routing_key => "some_topic", :persistent => true, :nowait => false ) { puts 'publish-ok'; EM.stop }</div>
<div>end</div><div><br></div><div>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.</div><div><br></div><div>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.</div>
<div><br></div><div>Is this expected behavior?</div><div><br></div><div>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.</div>
<br>-- <br><b>Elias Levy</b><div>Fellow, Technical Research Group</div><div>SourceFire</div><div><br></div><br>
</div>