有沒有辦法通過命令行(win/linux)刪除/清除ActiveMQ中的所有隊列? 我只能找到特定隊列的命令。 或者也許有辦法通過activeMQ管理員來做到這一點?再次,我只發現如何刪除/清除隊列中的一個接一個,這可能非常乏味。ActiveMQ - 通過命令行刪除/清除所有隊列
謝謝!
有沒有辦法通過命令行(win/linux)刪除/清除ActiveMQ中的所有隊列? 我只能找到特定隊列的命令。 或者也許有辦法通過activeMQ管理員來做到這一點?再次,我只發現如何刪除/清除隊列中的一個接一個,這可能非常乏味。ActiveMQ - 通過命令行刪除/清除所有隊列
謝謝!
你可以做調整你的activemq.xml
一點:
<broker deleteAllMessagesOnStartup="true" ...>
這適用於KahaDB郵件存儲(它與JDBC消息存儲問題),所有的郵件被刪除,隨後隊列被清除。
由於您希望刪除所有隊列,因此重新啓動代理並不是成本高昂的選項,無法清理所有內容。
我開發了我自己的ActiveMQ命令行實用程序(activemq-cli)來執行此操作。你可以在這裏找到它:https://github.com/antonwierenga/activemq-cli(命令'清除所有隊列'或'刪除所有隊列')。
另一種可能性是在一個容器(例如Apache ServiceMix)中部署一個小型駱駝路由,或者只是通過執行一個包含該路由的java程序。
例如,下面是我目前我的開發計算機上使用的路線,我也已經安裝了ServiceMix的:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd">
<cm:property-placeholder persistent-id="amq.cleanup" update-strategy="reload">
<cm:default-properties>
<cm:property name="amq.local.url" value="tcp://localhost:61616" />
</cm:default-properties>
</cm:property-placeholder>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<onException useOriginalMessage="true">
<exception>java.lang.Exception</exception>
<handled>
<constant>true</constant>
</handled>
<to uri="activemq:queue:CLEANUP_DLQ" />
</onException>
<route id="drop-all-queues" autoStartup="true">
<from uri="activemq:queue:*.>" />
<stop/>
</route>
</camelContext>
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="${amq.local.url}" />
</bean>
</blueprint>
截至5.0,它看起來像這個版本可以done using the CLI provided with ActiveMQ本身:
$ ActiveMQ/bin/activemq purge
謝謝,它的工作原理! – Ayelet 2014-12-03 12:57:15
它拯救了我的生命,謝謝! – walla 2016-05-01 17:15:06
@瓦拉歡迎,很高興幫助! – Vihar 2016-05-02 05:57:29