
Untitled
By: a guest on
Jul 11th, 2012 | syntax:
None | size: 1.06 KB | hits: 19 | expires: Never
import json
import sys
import qpid.messaging
def main(argv=None):
if argv is None:
argv = sys.argv
connection = qpid.messaging.Connection('localhost:5672')
connection.reconnect = True
connection.open()
addr_opts = {
"create": "always",
"node": {
"type": "topic",
"x-declare": {
"durable": True,
"auto-delete": True,
},
},
"link": {
"name": "glance_notifications.*",
"durable": True,
"x-declare": {
"durable": False,
"auto-delete": True,
"exclusive": False,
},
},
}
address = "glance/glance_notifications.* ; %s" % json.dumps(addr_opts)
session = connection.session()
receiver = session.receiver(address)
receiver.capacity = 1
while True:
try:
msg = receiver.fetch()
print msg
except KeyboardInterrupt:
break
return 0
if __name__ == '__main__':
sys.exit(main())