txamqp-user team mailing list archive
-
txamqp-user team
-
Mailing list archive
-
Message #00093
Error handling
Hello *,
I opened a bug[1] yesterday about error handling in txamqp, but as I'm
investigating further, I wonder if it's really a bug, or if I'm just
doing it wrong.
[1] https://bugs.launchpad.net/txamqp/+bug/956132
Here's the scenario. I call basic_publish on a non-existent exchange.
I'd like to catch the error and log it.
If I understand correctly, when I basic_publish to a non-existant
exchange, the basic_publish call succeeds, and then the servers sends a
channel_close() method to the client, with the following message :
(404, "NOT_FOUND - no exchange 'fake.exchange' in vhost '/'", 60, 40)
Then the client replies with close-ok(), and the channel is closed, no
more messages can be sent.
It looks like I can't detect that before the next action on the channel
(publish, close, anything), which will raise a Closed exception. Is
there any way to catch it sooner ? The optimal way would be, in my mind,
to have the basic_publish deferred call the errback chain, but I guess
that's just not possible with the current AMQP spec. Or is it ?
Then, I'd like to open another channel (channel re-opening is forbidden
by the spec) for the next operations, but I wonder how many channels I'm
allowed to open here. They are all stored in the AMQClient.channel dict,
which may grow out of hand if a message is repeatedly causing a
channel_close.
And in general, I'd love to get some advice on the recommended way to do
error handling with txAMQP. Experience and real-case situations are
welcomed too.
Thanks a lot !
Aurélien
--
http://www.projet-vigilo.org
http://www.c-s.fr/LL_r168.html
Tél : +33 1 41 28 44 33