txamqp-user team mailing list archive
-
txamqp-user team
-
Mailing list archive
-
Message #00017
Re: txconsumer.py/txpublisher.py sample issue
Hi Sebastian
sorry for the slow response, we had a lot of work at Fluidinfo last week.
On Fri, Sep 4, 2009 at 1:13 AM, Sebastian R. Wain
<sebastian.wain@xxxxxxxxxx> wrote:
> Hi,
>
> I was "playing" with txamqp samples and rabbitmq, but when I run the
> txconsumer.py (and publisher) sample with an incorrect username/password it
> prints "Connected to broker." but never ends, is it a sample "bug" or it's
> related with the txamqp library? since we are planning to use txamqp in a
> small project we are trying to understand the basics.
That's a bug in the scripts, if you surround the authentication code
with a try:..except, you'll see that it's raising an exception. Since
there's no function attached to gotConnection's Deferred, the script
doesn't report any error.
You can also add a function to the end of both scripts to call a
function in case an error occurs:
def handleError(e):
print "There was an error"
print e
...
d = ClientCreator(reactor, AMQClient, delegate=delegate, vhost=vhost,
spec=spec).connectTCP(host, port)
d.addCallback(gotConnection, username, password)
d.addErrback(handleError)
I apologize for being so slow answering your question and thanks for
using txAMQP.
Cheers.
References