summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAsk Solem <ask@celeryproject.org>2012-09-21 14:18:16 +0100
committerAsk Solem <ask@celeryproject.org>2012-09-21 14:18:37 +0100
commit9960aed306833e1299e7e3bf3e317adee3a4a6f4 (patch)
tree48a09f87cf3fcc7779e56c9e0bc3c230c4074b9b /examples
parentf678dc46fff91ae6cf07fc7b1ed0ebcc3ce9a7af (diff)
downloadkombu-9960aed306833e1299e7e3bf3e317adee3a4a6f4.tar.gz
examples/ cosmetics
Diffstat (limited to 'examples')
-rw-r--r--examples/complete_receive.py21
-rw-r--r--examples/simple_eventlet_receive.py2
2 files changed, 11 insertions, 12 deletions
diff --git a/examples/complete_receive.py b/examples/complete_receive.py
index e0093c0b..d7c8e948 100644
--- a/examples/complete_receive.py
+++ b/examples/complete_receive.py
@@ -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()
diff --git a/examples/simple_eventlet_receive.py b/examples/simple_eventlet_receive.py
index a8208650..1f88e713 100644
--- a/examples/simple_eventlet_receive.py
+++ b/examples/simple_eventlet_receive.py
@@ -40,4 +40,4 @@ def wait_many(timeout=1):
message.ack()
print(message.payload)
-spawn(wait_many).wait()
+eventlet.spawn(wait_many).wait()