You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Alan Conway <ac...@redhat.com> on 2011/05/05 16:58:13 UTC
Detecting queue existence with the messaging API.
Is there a neater way of testing for queue existence than this?
def queue_exists(queue,broker):
c = qpid.messaging.Connection(broker)
c.open()
s = c.session()
try:
try:
s.sender(queue)
return True
except qpid.messaging.exceptions.NotFound:
return False
finally: c.close()
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org
Re: Detecting queue existence with the messaging API.
Posted by Gordon Sim <gs...@redhat.com>.
On 05/05/2011 03:58 PM, Alan Conway wrote:
> Is there a neater way of testing for queue existence than this?
>
> def queue_exists(queue,broker):
> c = qpid.messaging.Connection(broker)
> c.open()
> s = c.session()
> try:
> try:
> s.sender(queue)
> return True
> except qpid.messaging.exceptions.NotFound:
> return False
> finally: c.close()
You could send a qmfv2 object-id query message and check the response.
Not sure that is any neater though.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org