from proton.reactor import Container, Copy
from proton.handlers import MessagingHandler
class Recv(MessagingHandler):
def __init__(self):
super(Recv, self).__init__()
def on_start(self, event):
conn = event.container.connect("localhost:5672")
event.container.create_receiver(conn, "examples", options=Copy())
def on_message(self, event):
print(event.message)
if event.receiver.queued == 0 and event.receiver.drained:
event.connection.close()
try:
Container(Recv()).run()
except KeyboardInterrupt:
pass
Apache Qpid, Messaging built on AMQP; Copyright © 2015 The Apache Software Foundation; Licensed under the Apache License, Version 2.0; Apache Qpid, Qpid, Qpid Proton, Proton, Apache, the Apache feather logo, and the Apache Qpid project logo are trademarks of The Apache Software Foundation; All other marks mentioned may be trademarks or registered trademarks of their respective owners