[rabbitmq-discuss] TX for guarantees of completion (was Re: persistence)

Tony Garnock-Jones tonyg at lshift.net
Fri May 30 10:15:19 BST 2008

Lars Bachmann wrote:
> Mathias,
> I made some more tests [...]

Just to reiterate what Matthias said: I think that using TX mode will
get you the behaviour you're after.

If you like, you could try the following:

  1. as soon as you have opened a channel, call txSelect() on it
  2. every 50 (or 10, or 100, or 500) publishes, call txCommit()
  3. just before you call close(), call txCommit()

If you do something like this, you are effectively using the txCommit
(and, importantly, the reply you receive to it from the server) as a
synchronisation point.

The reply to txCommit counts as confirmation from the server that all
the submitted messages prior to the commit have been processed.

The final call to txCommit immediately before close is the part that
forces all the outstanding work to be complete before the socket closes.

You can vary the number in step two to trade off latency against throughput.

Do let us know how this works out for you, if you try it!

 [][][] Tony Garnock-Jones     | Mob: +44 (0)7905 974 211
   [][] LShift Ltd             | Tel: +44 (0)20 7729 7060
 []  [] http://www.lshift.net/ | Email: tonyg at lshift.net

More information about the rabbitmq-discuss mailing list