You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Shan Wang <Sh...@igindex.co.uk> on 2009/03/18 14:44:52 UTC
how can I know if a queue name has been declared or not from a client?
My client program will declare the queue in the beginning, but there's
no point of redeclaring a queue if it already exists. Is there a API
call for clients to tell if a queue name is being used already?
Thanks & Regards,
Shan
The information contained in this email is strictly confidential and for the use of the addressee only, unless otherwise indicated. If you are not the intended recipient, please do not read, copy, use or disclose to others this message or any attachment. Please also notify the sender by replying to this email or by telephone (+44 (0)20 7896 0011) and then delete the email and any copies of it. Opinions, conclusions (etc.) that do not relate to the official business of this company shall be understood as neither given nor endorsed by it. IG Index plc is a company registered in England and Wales under number 01190902. VAT registration number 761 2978 07. Registered Office: Friars House, 157-168 Blackfriars Road, London SE1 8EZ. Authorised and regulated by the Financial Services Authority. FSA Register number 114059.
RE: how can I know if a queue name has been declared or not from a client?
Posted by Shan Wang <Sh...@igindex.co.uk>.
Thanks all, if it's more efficient to declare every time, then I'll stay
with this solution.
-----Original Message-----
From: Ted Ross [mailto:tross@redhat.com]
Sent: 18 March 2009 14:03
To: users@qpid.apache.org
Subject: Re: how can I know if a queue name has been declared or not
from a client?
Shan Wang wrote:
> My client program will declare the queue in the beginning, but there's
> no point of redeclaring a queue if it already exists. Is there a API
> call for clients to tell if a queue name is being used already?
>
There is a queue.query you could use for this purpose but it's easier
and more efficient to use queue.declare every time. queue.declare will
create the queue only if it doesn't already exist.
-Ted
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org
The information contained in this email is strictly confidential and for the use of the addressee only, unless otherwise indicated. If you are not the intended recipient, please do not read, copy, use or disclose to others this message or any attachment. Please also notify the sender by replying to this email or by telephone (+44 (0)20 7896 0011) and then delete the email and any copies of it. Opinions, conclusions (etc.) that do not relate to the official business of this company shall be understood as neither given nor endorsed by it. IG Index plc is a company registered in England and Wales under number 01190902. VAT registration number 761 2978 07. Registered Office: Friars House, 157-168 Blackfriars Road, London SE1 8EZ. Authorised and regulated by the Financial Services Authority. FSA Register number 114059.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org
Re: how can I know if a queue name has been declared or not from
a client?
Posted by Ted Ross <tr...@redhat.com>.
Shan Wang wrote:
> My client program will declare the queue in the beginning, but there's
> no point of redeclaring a queue if it already exists. Is there a API
> call for clients to tell if a queue name is being used already?
>
There is a queue.query you could use for this purpose but it's easier
and more efficient to use queue.declare every time. queue.declare will
create the queue only if it doesn't already exist.
-Ted
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org
Re: how can I know if a queue name has been declared or not from
a client?
Posted by Gordon Sim <gs...@redhat.com>.
Shan Wang wrote:
> My client program will declare the queue in the beginning, but there's
> no point of redeclaring a queue if it already exists. Is there a API
> call for clients to tell if a queue name is being used already?
Probably the simplest is to use queueQuery() and then test that the name
field of the result struct is the same as the queue you are querying. If
the name on the result is empty then the queue does not exist.
Also maybe worth mentioning that there is a passive argument to
queueDeclare() which if set causes the call to fail if the queue has not
already been declared (e.g. if you merely want to assert that the queue
has been created by some setup phase and not create it if it does not).
In terms of the queue being 'in use', there are two mechanisms for
controlling that. You can have an 'exclusive' queue that only your
session is allowed to use (use means subscriber to, delete, bind etc).
You can also have an exclusive subscription on a shared queue (e.g. to
ensure no one else is getting messages from that queue).
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org
Re: how can I know if a queue name has been declared or not from a
client?
Posted by Adam Chase <ad...@gmail.com>.
You can call session::queueQuery which will tell you. If you
redeclare, it wont mess up your queue though.
Adam
On Wed, Mar 18, 2009 at 9:44 AM, Shan Wang <Sh...@igindex.co.uk> wrote:
> My client program will declare the queue in the beginning, but there's
> no point of redeclaring a queue if it already exists. Is there a API
> call for clients to tell if a queue name is being used already?
>
>
>
>
>
> Thanks & Regards,
>
> Shan
>
> The information contained in this email is strictly confidential and for the use of the addressee only, unless otherwise indicated. If you are not the intended recipient, please do not read, copy, use or disclose to others this message or any attachment. Please also notify the sender by replying to this email or by telephone (+44 (0)20 7896 0011) and then delete the email and any copies of it. Opinions, conclusions (etc.) that do not relate to the official business of this company shall be understood as neither given nor endorsed by it. IG Index plc is a company registered in England and Wales under number 01190902. VAT registration number 761 2978 07. Registered Office: Friars House, 157-168 Blackfriars Road, London SE1 8EZ. Authorised and regulated by the Financial Services Authority. FSA Register number 114059.
>
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org