搜索

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

Chapter 5. Message Addresses and Queues

download PDF

AMQ 7 introduces a new, flexible addressing model that enables you to define standard messaging patterns that work for any messaging protocol. Therefore, the process for configuring queues and topic-like behavior has changed significantly.

5.1. Addressing Changes

AMQ 6 implemented JMS concepts such as queues, topics, and durable subscriptions as directly-configurable destinations.

Example: Default Queue and Topic Configuration in AMQ 6

<destinations>
     <queue physicalName="my-queue" />
     <topic physicalName="my-topic" />
</destinations>

AMQ Broker 7 uses addresses, routing types, and queues to achieve queue and topic-like behavior. An address represents a messaging endpoint. Queues are associated with addresses. A routing type defines how messages are distributed to the queues associated with an address. There are two routing types: Anycast distributes messages to a single queue within the matching address, and Multicast distributes messages to every queue associated with the address.

By associating queues with addresses and routing types, you can implement a variety of messaging patterns, such as point-to-point (queues) and publish-subscribe (topic-like).

Example: Point-to-Point Address Configuration in AMQ Broker 7

In this example, when the broker receives a message on address.foo, the message will be routed to my-queue. If multiple anycast queues are associated with the address, the messages are distributed evenly across the queues.

<address name="address.foo">
  <anycast>
    <queue name="my-queue"/>
  </anycast>
</address>

Example: Publish-Subscribe Address Configuration in AMQ Broker 7

In this example, when the broker receives a message on topic.foo, a copy of the message will be routed to both my-topic-1 and my-topic-2.

<address name="topic.foo">
  <multicast>
    <queue name="my-topic-1"/>
    <queue name="my-topic-2"/>
  </multicast>
</address>

Related Information

5.2. How Addressing is Configured

You use the BROKER_INSTANCE_DIR/etc/broker.xml configuration file to configure addresses and queues for your broker instance.

The broker.xml configuration file contains the following default addressing configuration in the <addresses> section. There are default entries for the Dead Letter Queue (DLQ) and Expiry Queue (ExpiryQueue):

<addresses>
   <address name="DLQ">
      <anycast>
         <queue name="DLQ" />
      </anycast>
   </address>
      <address name="ExpiryQueue">
         <anycast>
            <queue name="ExpiryQueue" />
         </anycast>
   </address>
</addresses>

You can configure addressing for your broker instance by using any of the following methods:

MethodDescription

Manually configure an address

You define the routing types and queues that the broker should use when receiving a message on the address. You can configure an address in the following ways:

Configure the broker to create addresses automatically

You specify an address prefix and routing type for which addresses you want to be created automatically. When the broker receives a message on an address that matches the prefix, the address and routing type will be created automatically. You can also specify that the address be deleted automatically when all of its queues have been deleted, and that its queues be deleted automatically when they have no consumers or messages.

For more information, see Creating and deleting addresses and queues automatically in Configuring AMQ Broker.

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.