[rabbitmq-discuss] How check for existing queue consumer

cw storm cwstorm at gmail.com
Wed Feb 12 17:25:49 GMT 2014


I suppose i can do "String consumerTag =
channel.queueDeclarePassive(strQueueName).getConsumerTag();"


On Wed, Feb 12, 2014 at 12:20 PM, cw storm <cwstorm at gmail.com> wrote:

> Hi Simon and team,
>
> Besides the number of active queue consumer, can I get the actual name or
> value that's in the consumer tag?
>
>
> On Wed, Feb 12, 2014 at 10:48 AM, cw storm <cwstorm at gmail.com> wrote:
>
>> Thanks guys.  The "int consumers =
>> channel.queueDeclarePassive(strQueueName).getConsumerCount();" will meet my
>> requirement.  In my service, I will check to see if that number is greater
>> than 0 or not.  If not, then issue "basicConsume".  But if my other server
>> need to also register the queue consumer as well, then maybe I need to
>> check if the number equals 2 instead.
>>
>> I'm just wondering if you have two servers, do you have both of your
>> server create a queue consumer to the queue?
>>
>>
>> On Wed, Feb 12, 2014 at 10:14 AM, cw storm <cwstorm at gmail.com> wrote:
>>
>>> Thanks guys.
>>>
>>> If I declare the queue exclusive, then my other server won't be able to
>>> register the queue consumer right?  We have two ESB servers for load
>>> balancing.  That means, two queue consumer for that queue.  However, if
>>> someone accidentally execute the service, then it'll create a new
>>> channel/connection and queue consumer for that queue.  That I don't want to
>>> happen.
>>>
>>>
>>> On Wed, Feb 12, 2014 at 10:04 AM, Alvaro Videla <videlalvaro at gmail.com>wrote:
>>>
>>>> Hi,
>>>>
>>>> If you need to have just one consumer per queue, then declare the
>>>> queue as exclusive.
>>>>
>>>> If you want to check if there are consumers attached to a particular
>>>> queue, then inspect the return values of issuing a passive
>>>> queueDeclare.
>>>>
>>>> Regards,
>>>>
>>>> Alvaro
>>>>
>>>> On Wed, Feb 12, 2014 at 3:59 PM, cw storm <cwstorm at gmail.com> wrote:
>>>> > Hi,
>>>> >
>>>> > I have a situation where someone executed the service that calls the
>>>> > "basicConsume" which basically assigns a queue consumer to that queue
>>>> on a
>>>> > different channel.  This cause multiple queue consumer for that
>>>> queue.  Is
>>>> > there someway in that service where I can check to see if an existing
>>>> queue
>>>> > consumer already exist for that queue before issue'ing the
>>>> "basicConsume"?
>>>> >
>>>> > _______________________________________________
>>>> > rabbitmq-discuss mailing list
>>>> > rabbitmq-discuss at lists.rabbitmq.com
>>>> > https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>>> >
>>>> _______________________________________________
>>>> rabbitmq-discuss mailing list
>>>> rabbitmq-discuss at lists.rabbitmq.com
>>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140212/db60e4de/attachment.html>


More information about the rabbitmq-discuss mailing list