4.6.4. Reading from the Message Queue

xml_consumer.py and listener.py simply read from a message queue and print the messages they receive. This code is identical to the code used to do the same in the direct exchange examples. For instance, here is the body of xml_consumer.py:
local_queue_name = "local_queue"
local_queue = session.incoming(local_queue_name)

session.message_subscribe(queue="message_queue", destination=local_queue_name)
local_queue.start()

message = None
while True:
   try:
	message = local_queue.get(timeout=10)
        session.message_accept(RangedSet(message.id))
	content = message.body
	print content
   except Empty:
        print "No more messages!"
        break