[rabbitmq-discuss] Publish won't work without transaction?

tsuraan tsuraan at gmail.com
Mon Sep 22 21:43:17 BST 2008

Using python's ampqlib, I'm doing the following:

import amqplib.client_0_8 as A

def main():
  conn = A.Connection('localhost', userid='tsuraan', password='tsuraan')
  chan = conn.channel()

  for i in range(1000):
    print i
    m = A.Message(str(i), delivery_mode=2)
    print chan.basic_publish(m, 'myexchange', 'myroute',
mandatory=True, immediate=True)

When I run that code, it never gives an error, but it also never
publishes a message.  The queues and exchanges are declared durable,
non auto-deleting.  If I put chan.tx_select() and chan.tx_commit()
around the basic_publish call, all the messages are delivered
correctly (i.e. they are in the queue associated with that exchange),
but the time to run the program goes from <1s to 72s.

Can I publish messages without using a transaction?

More information about the rabbitmq-discuss mailing list