[rabbitmq-discuss] txAMQP with RabbitMQ Cluster
Alex Clemesha
clemesha at gmail.com
Fri Mar 20 06:51:43 GMT 2009
Hi,
>
> 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:
298c298
< def start(self, response, mechanism='AMQPLAIN', locale='en_US',
insist=False):
---
> def start(self, response, mechanism='AMQPLAIN', locale='en_US'):
306,308c306
< 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
"defer.returnValue(response)"
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
--
Alex Clemesha
clemesha.org
More information about the rabbitmq-discuss
mailing list