summaryrefslogtreecommitdiff
path: root/examples/complete_receive.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/complete_receive.py')
-rw-r--r--examples/complete_receive.py21
1 files changed, 10 insertions, 11 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()