Permalink
Browse files

Fixed bug in tutorial 6 caused by misunderstanding of stop_consuming().

Apparently stop_consuming() does basic.cancel. Which is completely not what we want. Instead of using start/stop consuming, let's just do the busy loop by ourselves.
  • Loading branch information...
1 parent fba096f commit c1b178d9deec664cdf12770c24319c7d12d67efd @majek majek committed Aug 24, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 python/rpc_client.py
View
@@ -18,9 +18,9 @@ def __init__(self):
def on_response(self, ch, method, props, body):
if self.corr_id == props.correlation_id:
self.response = body
- self.channel.stop_consuming()
def call(self, n):
+ self.response = None
self.corr_id = str(uuid.uuid4())
self.channel.basic_publish(exchange='',
routing_key='rpc_queue',
@@ -29,7 +29,8 @@ def call(self, n):
correlation_id = self.corr_id,
),
body=str(n))
- self.channel.start_consuming()
+ while self.response is None:
+ self.connection.process_data_events()
return int(self.response)
fibonacci_rpc = FibonacciRpcClient()

0 comments on commit c1b178d

Please sign in to comment.