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 <[email protected]> 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/


Reply via email to