[rabbitmq-discuss] How check for existing queue consumer
cwstorm at gmail.com
Wed Feb 12 15:48:26 GMT 2014
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
> On Wed, Feb 12, 2014 at 10:04 AM, Alvaro Videla <videlalvaro at gmail.com>wrote:
>> 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
>> 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.
>> > there someway in that service where I can check to see if an existing
>> > consumer already exist for that queue before issue'ing the
>> > _______________________________________________
>> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rabbitmq-discuss