Skip to content

Commit

Permalink
Expose no_ack and exclusive to BlockingChannel.consume
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjefftang committed Oct 29, 2013
1 parent c8345ca commit 01dcea7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pika/adapters/blocking_connection.py
Expand Up @@ -679,7 +679,7 @@ def close(self, reply_code=0, reply_text="Normal Shutdown"):
self._set_state(self.CLOSED)
self._cleanup()

def consume(self, queue):
def consume(self, queue, no_ack=False, exclusive=False):
"""Blocking consumption of a queue instead of via a callback. This
method is a generator that returns messages a tuple of method,
properties, and body.
Expand All @@ -696,14 +696,20 @@ def consume(self, queue):
:param queue: The queue name to consume
:type queue: str or unicode
:param no_ack: Tell the broker to not expect a response
:type no_ack: bool
:param exclusive: Don't allow other consumers on the queue
:type exclusive: bool
:rtype: tuple(spec.Basic.Deliver, spec.BasicProperties, str or unicode)
"""
LOGGER.debug('Forcing data events on')
if not self._generator:
LOGGER.debug('Issuing Basic.Consume')
self._generator = self.basic_consume(self._generator_callback,
queue)
queue,
no_ack,
exclusive)
while True:
if self._generator_messages:
yield self._generator_messages.pop(0)
Expand Down

0 comments on commit 01dcea7

Please sign in to comment.