Este contenido no está disponible en el idioma seleccionado.
Chapter 6. Configuring the address space for message routing
AMQ Interconnect provides flexible application-layer addressing and delivery semantics. By configuring addresses, you can route messages in anycast (closest or balanced) or multicast patterns.
6.1. Routing messages between clients Copiar enlaceEnlace copiado en el portapapeles!
By default, AMQ Interconnect distributes messages in a balanced anycast pattern (each message is delivered to a single consumer, and AMQ Interconnect attempts to balance the traffic load across the network). This means you only need to change the address configuration if you want to apply non-default semantics to an address or range of addresses.
Procedure
This procedure configures an address to use multicast distribution. The router network will distribute a copy of each message sent to this address to every consumer that is subscribed to the address.
Start editing the
Interconnect
Custom Resource YAML file that describes the router deployment.oc edit -f router-mesh.yaml
$ oc edit -f router-mesh.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the
spec
section, define the semantics to be applied to addresses.Sample
router-mesh.yaml
fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Messages sent to any address that ends with “
orders
” will be distributed in a multicast pattern.
The Operator applies the changes to the router network and restarts each Pod.
If you have additional router deployment Custom Resources that define routers in the router network, repeat this procedure for each CR.
Each router in the router network must have the same address configuration.
Additional resources
- For more information about address semantics that you can configure, see Configuring message routing.
6.2. Routing messages through brokers Copiar enlaceEnlace copiado en el portapapeles!
If you need to store and forward messages, you can route them through a queue on a message broker. In this scenario, message producers send messages to a router, and the router sends the messages to a broker queue. When a consumer connects to the router to receive the messages, the router retrieves them from the broker queue.
You can route messages to brokers running in the same OpenShift cluster as the router network, or to brokers that are running outside of the cluster.
Prerequisites
- You must have access to a message broker.
Procedure
Start editing the Interconnect Custom Resource YAML file that describes the router deployment.
oc edit -f router-mesh.yaml
$ oc edit -f router-mesh.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the
spec
section, add a connector to connect to the broker, a waypoint address to point to the broker queue, and autolinks to create the links to the queue.Sample
router-mesh.yaml
fileCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The address (or set of addresses) for which messages should be stored on a broker queue.
- 2
- The autolink configuration. It defines the incoming and outgoing links and connection to be used to send and receive the messages on the broker.
- 3
- The connection to be used to connect the routers to the message broker.
The Operator applies the changes to the router network and restarts each Pod.
Verify that the router has established the autolinks to the message broker.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you have additional router deployment Custom Resources that define routers in the router network, repeat this procedure for each CR.
Each router in the router network must have the same address configuration.
Additional resources
- For more information about routing messages to and from broker queues, see Routing Messages through broker queues.