activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <>
Subject Re: How to find consumers on an exiting ActiveMQ Queue in c#
Date Wed, 26 Jul 2017 16:04:26 GMT
On 07/26/2017 11:56 AM, zaeem wrote:
> I have already checked the examples. Those let you create a queue or create a
> consumer and producer on existing queue or new queue. I'm only after finding
> information on an Existing Queue and how many producers there are under that
> queue.

The example on SO does much of what you want, have you actually tried 
it?  Did you ensure that the statistics broker plugin is installed on 
your broker?

> So Im able to successfully connect to AMQ using the snippet below
>              Uri connecturi = new Uri("activemq:tcp://****:61616");
>              IConnectionFactory factory = new
> NMSConnectionFactory(connecturi);
>              using (_connection = factory.CreateConnection())
>              {
>                  _connection.Start();
>                  using (_session = _connection.CreateSession())
>                  {
> /// Now here i should be able to check for a queue and the number of
> consumers it has
> /// Same thing for finding number of producers on that queue
>                     }
> Now on AMQ i have around 12 Queues for which i need information about.
> One Queue Example is Lets say "Test.Queue" which has 5 consumers. I need to
> know these 5 consumers on this queue

The statistics plugin won't give you consumer IDs, only a count of the 
consumers and producers on a destination.  You can try and figure out 
the information by listening in on advisory destinations as I've already 
said, I'd suggest you do some experimentation there.

> What or how would i write the c# equivalent code to access this queue using
> NMS and statistical plugin.
> The example on the URL is java based. Sorry im not been able to get around
> this issue and seems like there is no way other than writing something in
> Java

Since NMS is essentially the JMS API mapped to a .NET workflow the 
translation of a Java sample to a C# sample should be trivial.

> Thanks,
> Z
> }
> --
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at

Tim Bish
twitter: @tabish121

View raw message