1
votes

I'm getting desperate trying to handle errors when sending messages using Qpid Proton AMQP Messenger API for Python.

This is an example message sending session from the interactive Python interpreter when sending to a nonexistent queue myqueue on a Qpid broker running on localhost:

>>> from proton import *
>>> mng = Messenger()
>>> mng.timeout = 2000L
>>> m = Message()
>>> m.address = 'amqp://localhost/myqueue'
>>> m.subject = 'Test message'
>>> tracker = mng.put(m)
>>> repr(mng.status(tracker)) # status before send
'None'
>>> ret = mng.send()          # send unconditionally returns None
LINK ERROR (amqp:not-found) Node not found: myqueue
>>> repr(mng.status(tracker)) # status after send
'None'
>>> mng.stop()

The LINK ERROR is printed directly to stdout (or stderr) and there is no indication of the message not being delivered in the API. The status() call returns None before the send when the message is sitting in the buffer and also after, when it was dropped.

Am I missing something?

Using Python 2.7, Qpid Proton 0.7.

1
I'll just add that when the queue does exist and the message gets stored successfully, the work flow looks exactly the same, apart from the LINK ERROR message. There's no way of knowing in the code if the message got through to the queue. - Beli

1 Answers

2
votes

Finally. I read about property outgoing_window of the messenger defaulting to 0. It's the number of tracked outgoing messages. Setting it to a higher number solves the problem:

>>> from proton import *
>>> mng = Messenger()
>>> mng.timeout = 2000L
>>> mng.outgoing_window = 1
>>> m = Message()
>>> m.address = 'amqp://localhost/myqueue'
>>> m.subject = 'Test message'
>>> tracker = mng.put(m)
>>> repr(mng.status(tracker))
'PENDING'
>>> ret = mng.send()
LINK ERROR (amqp:not-found) Node not found: myqueue
>>> repr(mng.status(tracker))
'ABORTED'
>>> mng.stop()

Now I can track status of the message and see that it was ABORTED.