此内容没有您所选择的语言版本。

Chapter 4. Configuring Messaging Destinations


Note

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]
Copy to Clipboard Toggle word wrap

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
Copy to Clipboard Toggle word wrap

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
    }
}
Copy to Clipboard Toggle word wrap

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()
Copy to Clipboard Toggle word wrap

The table below provides all the attributes of a jms-queue:

Expand
AttributeDescription

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]
Copy to Clipboard Toggle word wrap

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
Copy to Clipboard Toggle word wrap
/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
    }
}
Copy to Clipboard Toggle word wrap

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()
Copy to Clipboard Toggle word wrap

The table below lists the attributes of a jms-topic:

Expand
AttributeDescription

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
Copy to Clipboard Toggle word wrap
jms-topic --help --commands
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat