[rabbitmq-discuss] how get list of queues / check queue exists

Andrius Norkaitis andrius.norkaitis at oryo.lt
Mon Jul 5 17:44:23 BST 2010


Hi.

 

I have occasionally connected clients (subscribers) which bids to
non-durable, exclusive, autodelete queue with their own ID.

I'm looking how to check which of the clients is online (queues with known
ids is available) or not.

 

If I could get a list of available queues I could compare their names with
ID to know which subscribers is online.

Also if there would be method to check is queue available I could iterate
through my list  and check it.

 

Rabbitmqctl has method to get list of available queues, but I haven't found
any way doing this using client.

 

I have founded one solution using QueueDeclare and passive flag:

 

bool QueueAvailable = false;

            try

            {

                var m = ch.QueueDeclare(routingKey, true, false, true, true,
false, null);

                QueueAvailable = true;

            }

            catch { }

 

If there is no queue available I get an exception, but also this closes the
connection so to check i.e. 500 queues I'll need to make a lot of new
connections every time.

 

Maybe there is more elegant solution?

 

Best regards

Andrius Norkaitis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100705/d2c0d4f8/attachment.htm>


More information about the rabbitmq-discuss mailing list