[rabbitmq-discuss] txAMQP with RabbitMQ Cluster

Esteve Fernandez esteve at sindominio.net
Thu Mar 19 19:42:47 GMT 2009


On Wednesday 18 March 2009 23:24:09 Alex Clemesha wrote:
> Hi,
>
> Can anyone who is using txAMQP (or the author, hi Esteve!) answer a
> couple of client related questions?

Hi Alex :-)

> First, does txAMQP support the "insist" flag?
> With py-amqplib, I can do:
> conn = amqp.Connection(host="localhost:5672 ", userid="guest",
> password="guest", virtual_host="/", insist=True),
> can the same be done with txAMPQ?  I've search around + looked in the
> source, and haven't found how to yet.

It should, as long as you pass the standard AMQP spec. txAMQP generates all 
the AMQP structures on the fly, it reads the XML spec and creates the 
appropiate methods and classes thanks to Qpid, from which txAMQP is based 
off.

I've never used the insist option, but I think this should work:

@defer.inlineCallbacks
def func(client):
    channel0 = yield client.channel(0)
    response = yield channel0.connection_open(vhost="/", insist=True)

> Secondly, and this is where I'm a bit more lost (i.e, the problem may
> or may not lie in the client),
> can txAMQP handle redirects from brokers?

Not yet, but I think it wouldn't be very hard to implement it. Here's some 
pseudo untested python code:

@defer.inlineCallbacks
def func(client):
    channel0 = yield client.channel(0)
    response = yield channel0.connection_open(vhost="/", insist=True)
    if response == OPEN-OK: # I don't remember the actual fields for a 
response, sorry
        # do as usual
    elif response == "redirect":
        yield channel0.connection_close() # close the current connection
        reactor.connectTCP(host=response.host,...) # create a connection to 
another broker using the standard Twisted methods

Sorry for being so imprecise, I'll try to add more details tomorrow. In any 
case, let me know if you need anything else.

Cheers.




More information about the rabbitmq-discuss mailing list