Here is a simple python script that fetches a message from a queue:
import qpid.messaging
connection = qpid.messaging.Connection('amqp://localhost:5672')
connection.open()
session = connection.session()
receiver = session.receiver('myQueue; {create: receiver, delete: never,
mode: consume}')
request = receiver.fetch(10)
print request.content
connection.close()
I have another python script that puts a message onto this queue:
import qpid.messaging
connection = qpid.messaging.Connection('amqp://localhost:5672')
connection.open()
session = connection.session()
sender = session.sender('myQueue')
request = qpid.messaging.Message(content = 'ping')
sender.send(request)
connection.close()
I start the first script, and then start the second script. As expected,
the message is received and both scripts exit. However, if I then run
the first script again, the same message is received again. This is
probably just a misunderstanding on my part, but I would have expected
the message to be consumed the first time the script was run. Please
could someone explain why the message is not consumed and remains in the
queue.
Regards,
Chris
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]