You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Kevin Burton <bu...@spinn3r.com> on 2014/06/14 02:15:04 UTC

Is it possible to get a list of queues on a remote broker?

I'm trying to figure out how to get a list of existing queues on a remote
broker.

It looks like I can listen to queues as they are created/destroyed by
adding an advisory message (which I don't yet have working) but I need to
get all EXISTING queues on startup.

It looks like I can do this with getDestinationMap:

http://activemq.apache.org/maven/apidocs/org/apache/activemq/broker/region/Region.html#getDestinationMap()

But that seems like it can only be called from an embedded and in-process
broker.

I mean... I'm willing to go that route but it seems to make more sense to
just have the normal init/daemon setup for activemq and then have a remote
process connect to it like a normal JMS consumer.

This documentation seems to imply that it's possible:

http://activemq.apache.org/how-can-i-see-what-destinations-are-used.html

But that's by using a Region object and that only seems possible if you're
in the same JVM as activemq.

-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
Skype: *burtonator*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>
War is peace. Freedom is slavery. Ignorance is strength. Corporations are
people.

Re: Is it possible to get a list of queues on a remote broker?

Posted by sarge <ag...@gmail.com>.
Can you post your solution Kevin?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Is-it-possible-to-get-a-list-of-queues-on-a-remote-broker-tp4682144p4696215.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Is it possible to get a list of queues on a remote broker?

Posted by Gary Tully <ga...@gmail.com>.
post your code or even better put it in a unit test. Then if it looks
sensibe we can add it to trunk to protect your use case into the
future

On 16 June 2014 23:57, Kevin Burton <bu...@spinn3r.com> wrote:
> I finally figured it out… took a while :-P
>
> I can post the code if you guys are interested.
>
> No one really was able to come up with the right question so I think I'm
> using something that's only semi documented or not used frequently
>
> Kevin
>
>
> On Mon, Jun 16, 2014 at 2:15 PM, artnaseef <ar...@artnaseef.com> wrote:
>
>> Ah, the target consumer ID - I see that now; here's the pertinent
>> AbstractSubscription snippet:
>>
>>
>>
>> If that does the job, then I don't see any concern with using the advisory.
>> Thanks Gary.
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/Is-it-possible-to-get-a-list-of-queues-on-a-remote-broker-tp4682144p4682203.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>
>
>
> --
>
> Founder/CEO Spinn3r.com
> Location: *San Francisco, CA*
> Skype: *burtonator*
> blog: http://burtonator.wordpress.com
> … or check out my Google+ profile
> <https://plus.google.com/102718274791889610666/posts>
> <http://spinn3r.com>
> War is peace. Freedom is slavery. Ignorance is strength. Corporations are
> people.



-- 
http://redhat.com
http://blog.garytully.com

Re: Is it possible to get a list of queues on a remote broker?

Posted by Kevin Burton <bu...@spinn3r.com>.
I finally figured it out… took a while :-P

I can post the code if you guys are interested.

No one really was able to come up with the right question so I think I'm
using something that's only semi documented or not used frequently

Kevin


On Mon, Jun 16, 2014 at 2:15 PM, artnaseef <ar...@artnaseef.com> wrote:

> Ah, the target consumer ID - I see that now; here's the pertinent
> AbstractSubscription snippet:
>
>
>
> If that does the job, then I don't see any concern with using the advisory.
> Thanks Gary.
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Is-it-possible-to-get-a-list-of-queues-on-a-remote-broker-tp4682144p4682203.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
Skype: *burtonator*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>
War is peace. Freedom is slavery. Ignorance is strength. Corporations are
people.

Re: Is it possible to get a list of queues on a remote broker?

Posted by artnaseef <ar...@artnaseef.com>.
Ah, the target consumer ID - I see that now; here's the pertinent
AbstractSubscription snippet:



If that does the job, then I don't see any concern with using the advisory. 
Thanks Gary.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Is-it-possible-to-get-a-list-of-queues-on-a-remote-broker-tp4682144p4682203.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Is it possible to get a list of queues on a remote broker?

Posted by Gary Tully <ga...@gmail.com>.
@Art if advisories go to all subs then that is a bug. I don't think it
is the case.
 the intention is to just deliver the existing subs to that single consumer.
note the use of org.apache.activemq.command.Message#setTargetConsumerId

On 16 June 2014 04:38, artnaseef <ar...@artnaseef.com> wrote:
> JMX and Jolokia are the most straight-forward solutions.
>
> It's possible to get the list in other ways.  For example, subscribing to
> the destination advisory will return all existing destinations:
>
> Here's the code snippet:
>             } else if
> (AdvisorySupport.isDestinationAdvisoryTopic(info.getDestination()))
> {
>                 // Replay all the destinations.
>                 for (DestinationInfo destination : destinations.values()) {
>                     ActiveMQTopic topic =
> AdvisorySupport.getDestinationAdvisoryTopic(destination.getDestination());
>                     fireAdvisory(context, topic, destination,
> info.getConsumerId());
>
> With that said, I recommend against the Advisory route.  Looking carefully
> at this code in context will reveal that adding one consumer to an
> advisory causes duplicate sends to all existing advisory consumers.  Very
> bad for scaling.
>
> Another possibility: ActiveMQConnection has a method named
> getDestinationSource() which returns an object for obtaining lists of
> destinations and listening for addition and removal of destinations.
>
>     http://activemq.apache.org/maven/apidocs/org/apache/activemq/ActiveMQConnection.html
>
> I'm not sure how security applies to this interface.
>
>>
>>
>> Hi
>>
>> There is a bin/activemq-admin script you can use to query a local /
>> remote broker about details.
>> It uses JMX for that, so you would need network connectivity that
>> works with that.
>>
>> If you are more a HTTP/REST guy then there is a REST api in ActiveMQ
>> exposed by Jolokia
>>
>> On a local broker its usually at
>> http://localhost:8161/api/jolokia
>>
>> Then its just a REST call to get the list of destinations.
>> We use that in hawtio to manage ActiveMQ brokers and a lot more.
>>
>>
>>
>> On Sat, Jun 14, 2014 at 2:15 AM, Kevin Burton <bu...@spinn3r.com> wrote:
>>> I'm trying to figure out how to get a list of existing queues on a
>>> remote
>>> broker.
>>>
>>> It looks like I can listen to queues as they are created/destroyed by
>>> adding an advisory message (which I don't yet have working) but I need
>>> to
>>> get all EXISTING queues on startup.
>>>
>>> It looks like I can do this with getDestinationMap:
>>>
>>> http://activemq.apache.org/maven/apidocs/org/apache/activemq/broker/region/Region.html#getDestinationMap()
>>>
>>> But that seems like it can only be called from an embedded and
>>> in-process
>>> broker.
>>>
>>> I mean... I'm willing to go that route but it seems to make more sense
>>> to
>>> just have the normal init/daemon setup for activemq and then have a
>>> remote
>>> process connect to it like a normal JMS consumer.
>>>
>>> This documentation seems to imply that it's possible:
>>>
>>> http://activemq.apache.org/how-can-i-see-what-destinations-are-used.html
>>>
>>> But that's by using a Region object and that only seems possible if
>>> you're
>>> in the same JVM as activemq.
>>>
>>> --
>>>
>>> Founder/CEO Spinn3r.com
>>> Location: *San Francisco, CA*
>>> Skype: *burtonator*
>>> blog: http://burtonator.wordpress.com
>>> … or check out my Google+ profile
>>> <https://plus.google.com/102718274791889610666/posts>
>>> <http://spinn3r.com>
>>> War is peace. Freedom is slavery. Ignorance is strength. Corporations
>>> are
>>> people.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: cibsen@redhat.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>> hawtio: http://hawt.io/
>> fabric8: http://fabric8.io/
>>
>>
>>
>>
>> _______________________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://activemq.2283324.n4.nabble.com/Is-it-possible-to-get-a-list-of-queues-on-a-remote-broker-tp4682144p4682150.html
>> To start a new topic under ActiveMQ - User, email
>> ml-node+s2283324n2341805h3@n4.nabble.com
>> To unsubscribe from ActiveMQ - User, visit
>> http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2341805&code=YXJ0QGFydG5hc2VlZi5jb218MjM0MTgwNXwtMjA1NDcyNjY5MQ==
>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Is-it-possible-to-get-a-list-of-queues-on-a-remote-broker-tp4682144p4682183.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://redhat.com
http://blog.garytully.com

Re: Is it possible to get a list of queues on a remote broker?

Posted by artnaseef <ar...@artnaseef.com>.
JMX and Jolokia are the most straight-forward solutions.

It's possible to get the list in other ways.  For example, subscribing to
the destination advisory will return all existing destinations:

Here's the code snippet:
            } else if
(AdvisorySupport.isDestinationAdvisoryTopic(info.getDestination()))
{
                // Replay all the destinations.
                for (DestinationInfo destination : destinations.values()) {
                    ActiveMQTopic topic =
AdvisorySupport.getDestinationAdvisoryTopic(destination.getDestination());
                    fireAdvisory(context, topic, destination,
info.getConsumerId());

With that said, I recommend against the Advisory route.  Looking carefully
at this code in context will reveal that adding one consumer to an
advisory causes duplicate sends to all existing advisory consumers.  Very
bad for scaling.

Another possibility: ActiveMQConnection has a method named
getDestinationSource() which returns an object for obtaining lists of
destinations and listening for addition and removal of destinations.

    http://activemq.apache.org/maven/apidocs/org/apache/activemq/ActiveMQConnection.html

I'm not sure how security applies to this interface.

>
>
> Hi
>
> There is a bin/activemq-admin script you can use to query a local /
> remote broker about details.
> It uses JMX for that, so you would need network connectivity that
> works with that.
>
> If you are more a HTTP/REST guy then there is a REST api in ActiveMQ
> exposed by Jolokia
>
> On a local broker its usually at
> http://localhost:8161/api/jolokia
>
> Then its just a REST call to get the list of destinations.
> We use that in hawtio to manage ActiveMQ brokers and a lot more.
>
>
>
> On Sat, Jun 14, 2014 at 2:15 AM, Kevin Burton <bu...@spinn3r.com> wrote:
>> I'm trying to figure out how to get a list of existing queues on a
>> remote
>> broker.
>>
>> It looks like I can listen to queues as they are created/destroyed by
>> adding an advisory message (which I don't yet have working) but I need
>> to
>> get all EXISTING queues on startup.
>>
>> It looks like I can do this with getDestinationMap:
>>
>> http://activemq.apache.org/maven/apidocs/org/apache/activemq/broker/region/Region.html#getDestinationMap()
>>
>> But that seems like it can only be called from an embedded and
>> in-process
>> broker.
>>
>> I mean... I'm willing to go that route but it seems to make more sense
>> to
>> just have the normal init/daemon setup for activemq and then have a
>> remote
>> process connect to it like a normal JMS consumer.
>>
>> This documentation seems to imply that it's possible:
>>
>> http://activemq.apache.org/how-can-i-see-what-destinations-are-used.html
>>
>> But that's by using a Region object and that only seems possible if
>> you're
>> in the same JVM as activemq.
>>
>> --
>>
>> Founder/CEO Spinn3r.com
>> Location: *San Francisco, CA*
>> Skype: *burtonator*
>> blog: http://burtonator.wordpress.com
>> … or check out my Google+ profile
>> <https://plus.google.com/102718274791889610666/posts>
>> <http://spinn3r.com>
>> War is peace. Freedom is slavery. Ignorance is strength. Corporations
>> are
>> people.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>
>
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://activemq.2283324.n4.nabble.com/Is-it-possible-to-get-a-list-of-queues-on-a-remote-broker-tp4682144p4682150.html
> To start a new topic under ActiveMQ - User, email
> ml-node+s2283324n2341805h3@n4.nabble.com
> To unsubscribe from ActiveMQ - User, visit
> http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2341805&code=YXJ0QGFydG5hc2VlZi5jb218MjM0MTgwNXwtMjA1NDcyNjY5MQ==





--
View this message in context: http://activemq.2283324.n4.nabble.com/Is-it-possible-to-get-a-list-of-queues-on-a-remote-broker-tp4682144p4682183.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Is it possible to get a list of queues on a remote broker?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

There is a bin/activemq-admin script you can use to query a local /
remote broker about details.
It uses JMX for that, so you would need network connectivity that
works with that.

If you are more a HTTP/REST guy then there is a REST api in ActiveMQ
exposed by Jolokia

On a local broker its usually at
http://localhost:8161/api/jolokia

Then its just a REST call to get the list of destinations.
We use that in hawtio to manage ActiveMQ brokers and a lot more.



On Sat, Jun 14, 2014 at 2:15 AM, Kevin Burton <bu...@spinn3r.com> wrote:
> I'm trying to figure out how to get a list of existing queues on a remote
> broker.
>
> It looks like I can listen to queues as they are created/destroyed by
> adding an advisory message (which I don't yet have working) but I need to
> get all EXISTING queues on startup.
>
> It looks like I can do this with getDestinationMap:
>
> http://activemq.apache.org/maven/apidocs/org/apache/activemq/broker/region/Region.html#getDestinationMap()
>
> But that seems like it can only be called from an embedded and in-process
> broker.
>
> I mean... I'm willing to go that route but it seems to make more sense to
> just have the normal init/daemon setup for activemq and then have a remote
> process connect to it like a normal JMS consumer.
>
> This documentation seems to imply that it's possible:
>
> http://activemq.apache.org/how-can-i-see-what-destinations-are-used.html
>
> But that's by using a Region object and that only seems possible if you're
> in the same JVM as activemq.
>
> --
>
> Founder/CEO Spinn3r.com
> Location: *San Francisco, CA*
> Skype: *burtonator*
> blog: http://burtonator.wordpress.com
> … or check out my Google+ profile
> <https://plus.google.com/102718274791889610666/posts>
> <http://spinn3r.com>
> War is peace. Freedom is slavery. Ignorance is strength. Corporations are
> people.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Is it possible to get a list of queues on a remote broker?

Posted by Geurt Schimmel <GS...@schubergphilis.com>.
Looks like you need JMX. i'm using Groovy to explore mbeans, slightly more work to do the same in Java, but it's very powerful.

Regards,
Geurt

Sent from my iPhone

> On 14 jun. 2014, at 02:16, "Kevin Burton" <bu...@spinn3r.com> wrote:
> 
> I'm trying to figure out how to get a list of existing queues on a remote
> broker.
> 
> It looks like I can listen to queues as they are created/destroyed by
> adding an advisory message (which I don't yet have working) but I need to
> get all EXISTING queues on startup.
> 
> It looks like I can do this with getDestinationMap:
> 
> http://activemq.apache.org/maven/apidocs/org/apache/activemq/broker/region/Region.html#getDestinationMap()
> 
> But that seems like it can only be called from an embedded and in-process
> broker.
> 
> I mean... I'm willing to go that route but it seems to make more sense to
> just have the normal init/daemon setup for activemq and then have a remote
> process connect to it like a normal JMS consumer.
> 
> This documentation seems to imply that it's possible:
> 
> http://activemq.apache.org/how-can-i-see-what-destinations-are-used.html
> 
> But that's by using a Region object and that only seems possible if you're
> in the same JVM as activemq.
> 
> -- 
> 
> Founder/CEO Spinn3r.com
> Location: *San Francisco, CA*
> Skype: *burtonator*
> blog: http://burtonator.wordpress.com
> … or check out my Google+ profile
> <https://plus.google.com/102718274791889610666/posts>
> <http://spinn3r.com>
> War is peace. Freedom is slavery. Ignorance is strength. Corporations are
> people.