there seems to be some support for tx_select, tx_commit, tx_rollback in the master branch of the amqp gem, but not in the 0.7.x-stable branch, which is what most people are using<br><br><div class="gmail_quote">2011/5/6 David Wragg <span dir="ltr"><<a href="mailto:david@rabbitmq.com">david@rabbitmq.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">Simon MacMullen <<a href="mailto:simon@rabbitmq.com">simon@rabbitmq.com</a>> writes:<br>
> On 05/05/11 22:33, Elias Levy wrote:<br>
>> While writing some code using the Ruby AMQP gem against RabbitMQ, I've<br>
>> noticed that if I publish a message and quickly close the connection,<br>
>> even though I've received a publish-ok response from the server, the<br>
>> message fails to be queued by the broker.<br>
><br>
> I'm not at all familiar with the Ruby client, but I should point out<br>
> that unlike many of the other AMQP methods, basic.publish does not<br>
> have a corresponding basic.publish-ok method; it's always<br>
> asynchronous. So I imagine the post-publish callback fires<br>
> immediately.<br>
><br>
> In order to be able to know when the broker has taken responsibility<br>
> for a message you can either wrap the publish in a transaction (when<br>
> you see tx.commit-ok you know the server has the message) or use the<br>
> rather more lightweight publish confirms:<br>
</div>o><br>
<div class="im">> <a href="http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/" target="_blank">http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/</a><br>
<br>
</div>Another way to solve the problem is to do a synchronous AMQP method<br>
rather than abruptly closing the connection. If this the sync method<br>
completes successfully, you can be sure that your published messages<br>
have reached the broker (it doesn't give you all the guarantees of<br>
transactions, but it is much lighter weight).<br>
<br>
An easy way to do this with all versions of the AMQP gem (even 0.6.7) is<br>
to use the AMQP#close callback. E.g., add something like this to your<br>
code:<br>
<br>
client.close { puts "Closed ok" ; EM.stop }<br>
<br>
David<br>
<font color="#888888"><br>
--<br>
David Wragg<br>
Staff Engineer, RabbitMQ<br>
VMware, Inc.<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</div></div></blockquote></div><br>