此内容没有您所选择的语言版本。
Chapter 3. ActiveMQ Console Commands
The activemq commands allow you to view and manage the brokers and messages.
Type
activemq:
then press Tab at the prompt to view the available commands.
3.1. activemq:browse, browse
Abstract
displays messages on a specified destination
Synopsis
activemq:browse
{
--amqurl brokerURL
} [
--msgsel
{
msgsel
...}
] [
--factory className
] [
--passwordFactory className
] [
--user username
] [
--password password
] [
--view
{
attr
...}
] [[
-Vheader
] | [
-Vcustom
] | [
-Vbody
]] [
--version
] [[
--help
] | [
-h
] | [
-?
]]
destName
Arguments
Table 3.1, “activemq:browse Arguments” describes the command's arguments.
Argument | Interpretation |
---|---|
--amqurl brokerURL | Specifies the URL of the broker to which you are connecting. |
--msgsel msgsel1,msgsel2,... | Displays messages matched by the message selector. |
--factory className | Load className as the javax.jms.ConnectionFactory to use for creating connections. |
--passwordFactory className | Load className as the org.apache.activemq.console.command.PasswordFactory for retrieving the password from a keystore. |
--user username | Username to use for JMS connections. |
--password password | Password to use for JMS connections. |
-Vheader | Shows all the standard JMS message headers. |
-Vcustom | Shows all the custom fields added to each JMS message. |
-Vbody | Shows the body of the message. |
--view attr1,attr1,... | Selects the specific attribute of the message to view. |
--version | Displays the version information. |
-h, -?, --help | Displays the online help for this command. |
Message filters
Message filters specified using the
--msgsel
option take the form header=value
. Table 3.2, “Message Headers for Filtering” lists the headers you can use to filter messages.
Name | Type |
---|---|
JMSCorrelationID | String |
JMSDeliveryMode | 1 -Non-Persistent, 2 -Persistent |
JMSDestination | javax.jms.Destination |
JMSExpiration | long |
JMSMessageID | String |
JMSPriority | int |
JMSRedelivered | boolean |
JMSReplyTo | javax.jms.Destination |
JMSTimestamp | long |
JMSType | String |
Examples
The following command prints the JMS message header, custom message header, and message body of all the messages in the queue
TEST.FOO
on a broker:
JBossA-MQ:karaf@root>
activemq:browse --amqurl tcp://localhost:61616 TEST.FOO
The following command displays the attributes from the body of the messages in the
TEST.FOO
queue:
JBossA-MQ:karaf@root>
activemq:browse --amqurl tcp://localhost:61616 -Vbody TEST.FOO
The following command displays any messages with an ID ending in
10
:
JBossA-MQ:karaf@root>
activemq:browse --amqurl tcp://localhost:61616 --msgsel JMSMessaageID='*:10' TEST.FOO
The following command displays messages with a priority of
3
, enter:
JBossA-MQ:karaf@root>
activemq:browse --amqurl tcp://localhost:61616 --msgsel JMSPriority=3 TEST.FOO
The message selectors from the preceding two examples can be combined as follows:
JBossA-MQ:karaf@root>
activemq:browse --amqurl tcp://localhost:61616 --msgsel JMSMessaageID='*:10',JMSPriority=3 TEST.FOO