You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Allans <al...@gmail.com> on 2016/02/01 07:59:21 UTC

Is there any way to perform queue operations in ActiveMQ without JMX

Currently I am using JMX to do ActiveMQ operations like purge, pause, stop,
etc. through JConsole. I would like to do the same without JMX
programmatically. I tried to use BrokerService of ActiveMQ, but couldn't
actually do it.

Can anyone please help me on this? I just want to remove JMX and use the
ActiveMQ API itself to perform queue operations.

It would be of great help if anyone can explain with example. Thanks in
advance.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Is-there-any-way-to-perform-queue-operations-in-ActiveMQ-without-JMX-tp4706712.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: Is there any way to perform queue operations in ActiveMQ without JMX

Posted by Allans <al...@gmail.com>.
Thanks a lot :-) Got hold of Region Broker which interfaces to many
operations.. 



--
View this message in context: http://activemq.2283324.n4.nabble.com/Is-there-any-way-to-perform-queue-operations-in-ActiveMQ-without-JMX-tp4706712p4706770.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: Is there any way to perform queue operations in ActiveMQ without JMX

Posted by Allans <al...@gmail.com>.
Thanks man :-). Will Give a try as an alternative solution..



--
View this message in context: http://activemq.2283324.n4.nabble.com/Is-there-any-way-to-perform-queue-operations-in-ActiveMQ-without-JMX-tp4706712p4706771.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Re: Is there any way to perform queue operations in ActiveMQ without JMX

Posted by Timothy Bish <ta...@gmail.com>.
On 02/01/2016 12:57 PM, Christopher Shannon wrote:
> The BrokerService is the correct place to do it.  The BrokerService is the
> entry point for the entire broker and just about anything that is
> accessible from JMX you should be able to get to from that object.  For
> something like managing a queue, you can start by using the BrokerService
> to get the RegionBroker and from there you can call getDestinationMap() and
> find the queue you want to use in that map.
>
> Something like should work:
>
> org.apache.activemq.broker.region.Queue queue =
> ((RegionBroker)brokerService.getRegionBroker()).getDestinationMap().get(new
> ActiveMQQueue("my.queue"));
> queue.purge();

Another option is to enable JMX but turn off the creation of the
management connector so that your code can access the AdminView via
brokerService.getAdminView() then you can do pretty much anything via
the standard MBeans. 

brokerService.getManagementContext().setCreateConnector(false);
brokerService.setUseJmx(true);


> On Mon, Feb 1, 2016 at 1:59 AM, Allans <al...@gmail.com> wrote:
>
>> Currently I am using JMX to do ActiveMQ operations like purge, pause, stop,
>> etc. through JConsole. I would like to do the same without JMX
>> programmatically. I tried to use BrokerService of ActiveMQ, but couldn't
>> actually do it.
>>
>> Can anyone please help me on this? I just want to remove JMX and use the
>> ActiveMQ API itself to perform queue operations.
>>
>> It would be of great help if anyone can explain with example. Thanks in
>> advance.
>>
>>
>>
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/Is-there-any-way-to-perform-queue-operations-in-ActiveMQ-without-JMX-tp4706712.html
>> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>>


-- 
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/



Re: Is there any way to perform queue operations in ActiveMQ without JMX

Posted by Christopher Shannon <ch...@gmail.com>.
The BrokerService is the correct place to do it.  The BrokerService is the
entry point for the entire broker and just about anything that is
accessible from JMX you should be able to get to from that object.  For
something like managing a queue, you can start by using the BrokerService
to get the RegionBroker and from there you can call getDestinationMap() and
find the queue you want to use in that map.

Something like should work:

org.apache.activemq.broker.region.Queue queue =
((RegionBroker)brokerService.getRegionBroker()).getDestinationMap().get(new
ActiveMQQueue("my.queue"));
queue.purge();

On Mon, Feb 1, 2016 at 1:59 AM, Allans <al...@gmail.com> wrote:

> Currently I am using JMX to do ActiveMQ operations like purge, pause, stop,
> etc. through JConsole. I would like to do the same without JMX
> programmatically. I tried to use BrokerService of ActiveMQ, but couldn't
> actually do it.
>
> Can anyone please help me on this? I just want to remove JMX and use the
> ActiveMQ API itself to perform queue operations.
>
> It would be of great help if anyone can explain with example. Thanks in
> advance.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Is-there-any-way-to-perform-queue-operations-in-ActiveMQ-without-JMX-tp4706712.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>

Re: Is there any way to perform queue operations in ActiveMQ without JMX

Posted by wuwufen <17...@qq.com>.
test reply



--
View this message in context: http://activemq.2283324.n4.nabble.com/Is-there-any-way-to-perform-queue-operations-in-ActiveMQ-without-JMX-tp4706712p4706765.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.