Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 4. Configuring Messaging Destinations
Remember, configuring messaging destinations requires JBoss EAP to have messaging enabled. This functionality is enabled by default when running with the standalone-full.xml
or standalone-full-ha.xml
configuration files. The domain.xml
configuration file also has messaging enabled.
4.1. Adding a Queue
To add a JMS queue, use the jms-queue
command from the management CLI:
jms-queue add --queue-address=myQueue --entries=[queue/myQueue jms/queue/myQueue java:jboss/exported/jms/queue/myQueue]
Note how the entries
attribute is a list containing multiple JNDI names separated by a single space. Also note the use of square brackets, []
, to enclose the list of JNDI names. The queue-address
provides routing configuration, and entries
provides a list of JNDI names that clients can use to look up the queue.
Reading a Queue’s Attributes
You can read a queue’s configuration using the jms-queue
command in the management CLI.
jms-queue read-resource --queue-address=myQueue
Alternatively, you can read a queue’s configuration by accessing the messaging-activemq
subsystem using the management CLI:
/subsystem=messaging-activemq/server=default/jms-queue=myQueue:read-resource() { "outcome" => "success", "result" => { "durable" => true, "entries" => ["queue/myQueue jms/queue/myQueue java:jboss/exported/jms/queue/myQueue"], "legacy-entries" => undefined, "selector" => undefined } }
Attributes of a jms-queue
The management CLI displays all the attributes of the jms-queue
configuration element when given the following command:
/subsystem=messaging-activemq/server=default/jms-queue=*:read-resource-description()
The table below provides all the attributes of a jms-queue
:
Attribute | Description |
---|---|
consumer-count | The number of consumers consuming messages from this queue. Available at runtime. |
dead-letter-address | The address to send dead messages to. See Configuring Dead Letter Addresses for more information. |
delivering-count | The number of messages that this queue is currently delivering to its consumers. Available at runtime. |
durable | Whether the queue is durable or not. See Messaging Styles for more information on durable subscriptions. |
entries | The list of JNDI names the queue will be bound to. Required. |
expiry-address | The address that will receive expired messages. See Configuring Message Expiry for details. |
legacy-entries | The JNDI names the queue will be bound to. |
message-count | The number of messages currently in this queue. Available at runtime. |
messages-added | The number of messages added to this queue since it was created. Available at runtime. |
paused | Whether the queue is paused. Available at runtime. |
queue-address | The queue address defines what address is used for routing messages. See Configuring Address Settings for details on address settings. Required. |
scheduled-count | The number of scheduled messages in this queue. Available at runtime. |
selector | The queue selector. For more information on selectors see Filter Expressions and Message Selectors. |
temporary | Whether the queue is temporary. See Temporary Queues and Runtime Queues for more information. |
4.2. Adding a Topic
Adding or reading a topic is much like adding a queue:
jms-topic add --topic-address=myTopic --entries=[topic/myTopic jms/topic/myTopic java:jboss/exported/jms/topic/myTopic]
Reading a Topic’s Attributes
Reading topic attributes also has syntax similar to that used for a queue:
jms-topic read-resource --topic-address=myTopic entries topic/myTopic jms/topic/myTopic java:jboss/exported/jms/topic/myTopic legacy-entries=n/a
/subsystem=messaging-activemq/server=default/jms-topic=myTopic:read-resource { "outcome" => "success", "result" => { "entries" => ["topic/myTopic jms/topic/myTopic java:jboss/exported/jms/topic/myTopic"], "legacy-entries" => undefined } }
Attributes of a jms-topic
The management CLI displays all the attributes of the jms-topic
configuration element when given the following command:
/subsystem=messaging-activemq/server=default/jms-topic=*:read-resource-description()
The table below lists the attributes of a jms-topic
:
Attribute | Description |
---|---|
delivering-count | The number of messages that this queue is currently delivering to its consumers. Available at runtime. |
durable-message-count | The number of messages for all durable subscribers for this topic. Available at runtime. |
durable-subscription-count | The number of durable subscribers for this topic. Available at runtime. |
entries | The JNDI names the topic will be bound to. Required. |
legacy-entries | The legacy JNDI names the topic will be bound to. |
message-count | The number of messages currently in this queue. Available at runtime. |
messages-added | The number of messages added to this queue since it was created. Available at runtime. |
non-durable-message-count | The number of messages for all non-durable subscribers for this topic. Available at runtime. |
non-durable-subscription-count | The number of non-durable subscribers for this topic. Available at runtime. |
subscription-count | The number of (durable and non-durable) subscribers for this topic. Available at runtime. |
temporary | Whether the topic is temporary. |
topic-address | The address the topic points to. Required. |
4.3. JNDI Entries and Clients
A queue or topic must be bound to the java:jboss/exported
namespace for a remote client to be able to look it up. The client must use the text after java:jboss/exported/
when doing the lookup. For example, a queue named testQueue
has for its entries
the list jms/queue/test java:jboss/exported/jms/queue/test
. A remote client wanting to send messages to testQueue
would look up the queue using the string jms/queue/test
. A local client on the other hand could look it up using java:jboss/exported/jms/queue/test
, java:jms/queue/test
, or more simply jms/queue/test
.
Management CLI Help
You can find more information about the jms-queue
and jms-topic
commands by using the --help --commands
flags:
jms-queue --help --commands
jms-topic --help --commands