examples/ cosmetics

This commit is contained in:
Ask Solem 2012-09-21 14:18:16 +01:00
parent f678dc46ff
commit 9960aed306
3 changed files with 12 additions and 12 deletions

View File

@ -28,17 +28,16 @@ def handle_message(body, message):
#: the values below are the default, but listed here so it can
#: be easily changed.
with Connection('pyamqp://guest:guest@localhost:5672//') as connection:
"""The configuration of the message flow is as follows:
gateway_kombu_exchange -> internal_kombu_exchange -> kombu_demo queue
"""
gateway_exchange = Exchange('gateway_kombu_demo', type='direct')
exchange = Exchange('internal_kombu_demo', type='direct')
binded = exchange.bind(connection.channel())
binded.exchange_bind(gateway_exchange, routing_key = 'kombu_demo')
# The configuration of the message flow is as follows:
# gateway_kombu_exchange -> internal_kombu_exchange -> kombu_demo queue
gateway_exchange = Exchange('gateway_kombu_demo')(connection)
exchange = Exchange('internal_kombu_demo')(connection)
gateway_exchange.declare()
exchange.declare()
exchange.bind_to(gateway_exchange, routing_key='kombu_demo')
queue = Queue('kombu_demo', exchange, routing_key='kombu_demo')
#: Create consumer using our callback and queue.
#: Second argument can also be a list to consume from
#: any number of queues.
@ -46,7 +45,7 @@ with Connection('pyamqp://guest:guest@localhost:5672//') as connection:
#: This waits for a single event. Note that this event may not
#: be a message, or a message that is to be delivered to the consumers
#: channel, but any event received on the connection.
#: channel, but any event received on the connection.
recv = eventloop(connection)
while True:
recv.next()

View File

@ -40,4 +40,4 @@ def wait_many(timeout=1):
message.ack()
print(message.payload)
spawn(wait_many).wait()
eventlet.spawn(wait_many).wait()

View File

@ -122,6 +122,7 @@ _filetype_to_type = {"py": PyVersion,
"c": CPPVersion,
"h": CPPVersion}
def filetype_to_type(filename):
_, _, suffix = filename.rpartition(".")
return _filetype_to_type[suffix](filename)