[rabbitmq-discuss] txAMQP with RabbitMQ Cluster

Alex Clemesha clemesha at gmail.com
Fri Mar 20 06:51:43 GMT 2009


> 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)
Yep, this works, thanks!

>> 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.
Thanks for the tips, with them we've be able to get pass this for right now.

The 'fixes' that I made to successfully move past the two above issues basically
came down to making some minor changes to the "start"  method of
"AMQClient" in "protocol.py".
The diff looks like this:

<     def start(self, response, mechanism='AMQPLAIN', locale='en_US',
>     def start(self, response, mechanism='AMQPLAIN', locale='en_US'):
<         response = yield channel0.connection_open(self.vhost, insist=insist)
<         defer.returnValue(response)
>         yield channel0.connection_open(self.vhost)

The changes are adding the "insist" flag and doing a
such that I can inspect the "response.method.name" to see if I have a
redirect or not.
Then, at this point, it is an my application's concern to close the
current connection and
make a new connection to the redirect destination.

So, I'm wondering: 1) is there a cleaner way of doing this, 2) are the
modifications that I made
in the source in the right place, 3) should the redirect be a txAMQP
concern or an application
concern, 4) should I be sending you patches :-)

thanks very much!

Alex Clemesha

More information about the rabbitmq-discuss mailing list