Skip to content

Commit

Permalink
Merge pull request #1135 from claws/fix_example
Browse files Browse the repository at this point in the history
Fix examples for new API
  • Loading branch information
lukebakken committed Dec 18, 2018
2 parents ea7d010 + d08d1fa commit 96875f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions examples/asynchronous_consumer_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def on_queue_declareok(self, method_frame, userdata):
self.EXCHANGE, queue_name, self.ROUTING_KEY)
cb = functools.partial(self.on_bindok,
userdata=queue_name)
self._channel.queue_bind(queue=queue_name,
exchange=self.EXCHANGE,
self._channel.queue_bind(queue_name,
self.EXCHANGE,
routing_key=self.ROUTING_KEY,
callback=cb)

Expand Down Expand Up @@ -240,8 +240,8 @@ def start_consuming(self):
"""
LOGGER.info('Issuing consumer related RPC commands')
self.add_on_cancel_callback()
self._consumer_tag = self._channel.basic_consume(queue=self.QUEUE,
callback=self.on_message)
self._consumer_tag = self._channel.basic_consume(self.QUEUE,
self.on_message)

def add_on_cancel_callback(self):
"""Add a callback that will be invoked if RabbitMQ cancels the consumer
Expand Down Expand Up @@ -301,8 +301,7 @@ def stop_consuming(self):
LOGGER.info('Sending a Basic.Cancel RPC command to RabbitMQ')
cb = functools.partial(self.on_cancelok,
userdata=self._consumer_tag)
self._channel.basic_cancel(consumer_tag=self._consumer_tag,
callback=cb)
self._channel.basic_cancel(self._consumer_tag, cb)

def on_cancelok(self, unused_frame, userdata):
"""This method is invoked by pika when RabbitMQ acknowledges the
Expand Down
4 changes: 2 additions & 2 deletions examples/asynchronous_publisher_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def on_queue_declareok(self, method_frame):
self.EXCHANGE, self.QUEUE, self.ROUTING_KEY)
self._channel.queue_bind(self.QUEUE,
self.EXCHANGE,
self.ROUTING_KEY,
routing_key=self.ROUTING_KEY,
callback=self.on_bindok)

def on_bindok(self, unused_frame):
Expand Down Expand Up @@ -233,7 +233,7 @@ def enable_delivery_confirmations(self):
"""
LOGGER.info('Issuing Confirm.Select RPC command')
self._channel.confirm_delivery(ack_nack_callback=self.on_delivery_confirmation)
self._channel.confirm_delivery(self.on_delivery_confirmation)

def on_delivery_confirmation(self, method_frame):
"""Invoked by pika when RabbitMQ responds to a Basic.Publish RPC
Expand Down

0 comments on commit 96875f0

Please sign in to comment.