[rabbitmq-discuss] py-amqplib status messages

Matthias Radestock matthias at lshift.net
Tue Nov 25 21:07:05 GMT 2008


Dmitriy,

Dmitriy Samovskiy wrote:

> This means that I either have to do buffering inside producer in order 
> to be able to resend them all, or I have to wrap each basic.publish in tx.
> 
> In latter case, it's a total of 5 methods (tx.select, tx.select-ok, 
> basic.publish, tx.commit, tx.commit-ok).

You only need the tx.select/select-ok before the first message. And 
there is nothing forcing you to commit after *every* message. Instead 
keep a bounded buffer of n messages and commit every n. That's far more 
efficient than requiring an ack for every single message.

The downside is that even with this optimised usage tx is quite 
expensive and does a lot more than what you want here.

There is an alternative to using tx: issue *any* synchronous command. 
The response constitutes a guarantee that all messages published prior 
to the request will have been processed by the channel process on the 
server. They may still get lost on their way too queues, but that only 
happens in case of a server fault. Furthermore, if the basic.publish has 
the mandatory flag set then in the latter case a basic.return is 
guaranteed to be sent prior to the synchronous command response.

AFAIK that behaviour is not mandated by the spec though.


Matthias.




More information about the rabbitmq-discuss mailing list