You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by aybeeryu <ab...@gmail.com> on 2012/12/19 00:43:22 UTC

How to delete all queues and topics programmatically without using any JMX?

Hi,


I was looking for a way to delete all queues/topics or specific
queues/topics(given the queue/topic names as input) without using any of
jmx. I did a bit of research and came to an understanding that the only way
to remove queues/topics was with the help of BrokerViewMBean of JMX. But is
there a way to do this without using any JMX components? 

Thanks in advance



--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-delete-all-queues-and-topics-programmatically-without-using-any-JMX-tp4660871.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to delete all queues and topics programmatically without using any JMX?

Posted by aybeeryu <ab...@gmail.com>.
well, the primary purpose for the issue was to have a way to clear everything
when restarting a web app that uses these queues and topics. Although we did
find a way to achieve this by changing the config file of activemq which
clears the queues each time activemq is restart, although i was thinking if
we had a better way to do it programmatically would be nicer.  



--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-delete-all-queues-and-topics-programmatically-without-using-any-JMX-tp4660871p4660908.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to delete all queues and topics programmatically without using any JMX?

Posted by Claudio Corsi <cl...@yahoo.com>.
If you intend to delete destinations that have no entries, inactive,  then you can use the inactive destination policy that is part of the policy entry in the policy map.

Here is a link:

http://activemq.apache.org/delete-inactive-destinations.html





>________________________________
> From: aybeeryu <ab...@gmail.com>
>To: users@activemq.apache.org 
>Sent: Tuesday, December 18, 2012 6:43 PM
>Subject: How to delete all queues and topics programmatically without using any JMX?
> 
>Hi,
>
>
>I was looking for a way to delete all queues/topics or specific
>queues/topics(given the queue/topic names as input) without using any of
>jmx. I did a bit of research and came to an understanding that the only way
>to remove queues/topics was with the help of BrokerViewMBean of JMX. But is
>there a way to do this without using any JMX components? 
>
>Thanks in advance
>
>
>
>--
>View this message in context: http://activemq.2283324.n4.nabble.com/How-to-delete-all-queues-and-topics-programmatically-without-using-any-JMX-tp4660871.html
>Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>
>

Reply:Re: How to delete all queues and topics programmatically without using any JMX?

Posted by SuoNayi <su...@163.com>.
I would not recommend deleting destination like that. 
Because the broker can process the removal destination command(the processRemoveDestination method in the TransportConnection class).
So we can send a removal destination  command to the broker from the client. 
You can refer the deleteTempDestination method in the ActiveMQConnection  class and that should work.

If it does work please let me known.


At 2012-12-19 08:06:15,"Christian Posta" <ch...@gmail.com> wrote:
>Not sure if there's a good way to do it using activemq-admin (although i
>think that script uses JMX under the covers to do some things).. but if
>you're trying to do it within code, then you'll need to get hold of the
>"region broker" (BrokerService.getRegionBroker) and on that class you can
>get a list of the destinations and there's a remove destination method. It
>wasn't intended for user code, so there might need to be some hacking to
>get it working right.
>
>
>
>
>On Tue, Dec 18, 2012 at 4:43 PM, aybeeryu <ab...@gmail.com> wrote:
>
>> Hi,
>>
>>
>> I was looking for a way to delete all queues/topics or specific
>> queues/topics(given the queue/topic names as input) without using any of
>> jmx. I did a bit of research and came to an understanding that the only way
>> to remove queues/topics was with the help of BrokerViewMBean of JMX. But is
>> there a way to do this without using any JMX components?
>>
>> Thanks in advance
>>
>>
>>
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/How-to-delete-all-queues-and-topics-programmatically-without-using-any-JMX-tp4660871.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>
>
>
>-- 
>*Christian Posta*
>http://www.christianposta.com/blog
>twitter: @christianposta

Re: How to delete all queues and topics programmatically without using any JMX?

Posted by Christian Posta <ch...@gmail.com>.
Not sure if there's a good way to do it using activemq-admin (although i
think that script uses JMX under the covers to do some things).. but if
you're trying to do it within code, then you'll need to get hold of the
"region broker" (BrokerService.getRegionBroker) and on that class you can
get a list of the destinations and there's a remove destination method. It
wasn't intended for user code, so there might need to be some hacking to
get it working right.




On Tue, Dec 18, 2012 at 4:43 PM, aybeeryu <ab...@gmail.com> wrote:

> Hi,
>
>
> I was looking for a way to delete all queues/topics or specific
> queues/topics(given the queue/topic names as input) without using any of
> jmx. I did a bit of research and came to an understanding that the only way
> to remove queues/topics was with the help of BrokerViewMBean of JMX. But is
> there a way to do this without using any JMX components?
>
> Thanks in advance
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/How-to-delete-all-queues-and-topics-programmatically-without-using-any-JMX-tp4660871.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta