Red Hat Training

A Red Hat training course is available for Red Hat Fuse

3.4. activemq:purge, purge


purges messages from a destination


activemq:purge [ --msgsel { msgsel ...} ] [ --pid PID ] [ --jmxurl JMXUrl ] [ -jmxuser userName ] [ -jmxpassword password ] [ -jmxlocal ] [ --version ] [[ --help ] | [ -h ] | [ -? ]] { destName }


Table 3.5, “activemq:purge Arguments” describes the command's arguments.

Table 3.5. activemq:purge Arguments

--msgsel msgsel1,msgsel2,...Purges messages matched by the message selector. See the section called “Message filters”.
--jmxurl URL Sets the JMX URL used to locate the broker.
--pid PID Set the pid to connect to (only on Sun JVM).
--jmxuser user Sets the JMX user, used for authentication.
--jmxpassword password Sets the JMX password, used for authentication.
--jmxlocal Specifies to use the local JMX server instead of a remote server
--version Displays the version information
-h, -?, --help Displays the online help for this command
destName The specified message destination(s)


The following command purges all the messages in the queue TEST.FOO on a broker:
JBossA-MQ:karaf@root>activemq:purge TEST.FOO
The following command purges any messages with an ID ending in 10:
JBossA-MQ:karaf@root>activemq:purge --msgsel JMSMessaageID='*:10' TEST.FOO
The following command purges messages with a priority of 3, enter:
JBossA-MQ:karaf@root>activemq:purge --msgsel JMSPriority=3 TEST.FOO
The message selectors from the preceding two examples can be combined as follows:
JBossA-MQ:karaf@root>activemq:purge --msgsel JMSMessaageID='*:10',JMSPriority=3 TEST.FOO