Skip to content

Commit

Permalink
Added the ability to do binding.queue_declare(passive=True) to get qu…
Browse files Browse the repository at this point in the history
…eue status.
  • Loading branch information
Ask Solem committed Jul 22, 2010
1 parent 7fdd345 commit cc08721
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions kombu/entity.py
Expand Up @@ -104,22 +104,28 @@ def __init__(self, name="", exchange=None, routing_key="", channel=None,
def when_bound(self):
self.exchange = self.exchange(self.channel)

def queue_declare(self, nowait=False, passive=False):
return self.channel.queue_declare(queue=self.name,
passive=passive,
durable=self.durable,
exclusive=self.exclusive,
auto_delete=self.auto_delete,
arguments=self.queue_arguments,
nowait=nowait)

def queue_bind(self, nowait=False):
return self.channel.queue_bind(queue=self.name,
exchange=self.exchange.name,
routing_key=self.routing_key,
arguments=self.binding_arguments,
nowait=nowait)

def declare(self, nowait=False):
"""Declares the queue, the exchange and binds the queue to
the exchange."""
chan = self.channel
return (self.exchange and self.exchange.declare(),
self.name and chan.queue_declare(queue=self.name,
durable=self.durable,
exclusive=self.exclusive,
auto_delete=self.auto_delete,
arguments=self.queue_arguments,
nowait=nowait),
self.name and chan.queue_bind(queue=self.name,
exchange=self.exchange.name,
routing_key=self.routing_key,
arguments=self.binding_arguments,
nowait=nowait))
return (self.exchange and self.exchange.declare(nowait),
self.name and self.queue_declare(nowait, passive=False),
self.name and self.queue_bind(nowait))

def get(self, no_ack=None):
message = self.channel.basic_get(queue=self.name, no_ack=no_ack)
Expand Down

0 comments on commit cc08721

Please sign in to comment.