activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From centis <centis_b...@hotmail.com>
Subject Re: Programmatically purge() a queue
Date Wed, 12 Aug 2009 14:19:37 GMT

Bruce,

Thanks for your reply!  I've seen several examples like that the problem I
am having is the "broker".  I'm not using an embedded broker, the problem
I'm having is getting the "broker" object.  I'm poking around in the samples
but I don't see an example that doesn't use an embedded broker.

CB


bsnyder wrote:
> 
> On Tue, Aug 11, 2009 at 1:40 PM, centis<centis_biks@hotmail.com> wrote:
>>
>> I am trying to find an example of purging a Queue from Java.  Can someone
>> point me to someting besides, "Using JMX..." :)  I just need a way to
>> clear
>> out the existing queues before my regression tests run.
> 
> Oddly, the solution is to use JMX; just programatically instead of via
> Jconsole. Here's an example:
> 
> // The ActiveMQ JMX domain
> String amqDomain = "org.apache.activemq";
> 
> // The parameters for an ObjectName
> Hashtable<String, String> params = new Hashtable<String, String>();
> params.put("Type", "Queue");
> params.put("BrokerName", brokerName);
> params.put("Destination", queueName);
> 
> // Create an ObjectName
> ObjectName queueObjectName = ObjectName.getInstance(amqDomain, params);
> 
> // Create a proxy to the QueueViewMBean
> QueueViewMBean queueProxy = (QueueViewMBean)
> broker.getManagementContext().newProxyInstance(queueObjectName,
> QueueViewMBean.class, true);
> 
> // Purge the queue
> queueProxy.purge();
> 
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> ActiveMQ in Action: http://bit.ly/2je6cQ
> Blog: http://bruceblog.org/
> Twitter: http://twitter.com/brucesnyder
> 
> 

-- 
View this message in context: http://www.nabble.com/Programmatically-purge%28%29-a-queue-tp24923382p24937567.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message