A routing path defines a sequential list of intermediary
bus destinations that messages must pass through to reach a target
bus destination. A routing path is used to apply the mediations configured
on several destinations to messages sent along the path.
Figure 1. Routing paths
A forward routing path identifies a list of bus destinations
that a message should be sent to, from the producer to the last destination
from which consumers retrieve messages. The reverse routing
path is constructed automatically for request/reply messages,
and identifies the list of destinations that any reply message should
be sent to, from the consumer back to the producer. Use of reverse
routing path enables a reply message to take a different route back
to the producer, and therefore have more mediations applied.
When a message arrives at a destination in the path, mediations
can manipulate the entries in the forward routing path, to change
the sequence of destinations through which messages pass. If a mediation
manipulates the forward routing path, and the reverse routing path
is set for a request message that expects a reply, the mediation is
responsible for making any corresponding changes to the reverse routing
path.
A destination without mediations can be included in a routing path
to provide a future option to apply a mediation assigned to that destination.
Do not include a topic space in a forward routing path.
If the first element of the routing path does not represent a destination
known to the bus, the message is sent to the exception destination
defined for the current destination.
Forward routing paths
A producer can attach
to one destination and pass messages along a
forward routing
path to the target destination that consumers use.
- The producer can set the forward routing path in the original
message.
- An administrator can configure a default forward routing path
on destinations for use by messages that do not contain a forward
routing path.
When a message is sent to a destination (either directly,
or by following its forward routing path), and before invoking any
mediation at the destination, the
Default forward routing path property
of the destination is applied to the forward routing path of the message,
as follows:
- If the incoming message contains an empty forward routing path,
the forward routing path in the message is set to the value of the Default forward routing path property
of the destination (which also can be empty or null).
- If the incoming message has a non-empty forward routing path,
it is left unchanged. After applying any mediations, the message is
forwarded to the next destination in the path. When the last destination
in the path is reached, the message is handled by that destination.
Reverse routing paths
A producer can ask
for reply messages by specifying a reply destination in messages it
sends. The reverse routing path is constructed dynamically
as the message passes from one destination to another along the forward
routing path.
When a message is sent to a destination (either
directly, or by following its forward routing path), and before invoking
any mediation at the destination, the
Reply destination property
of the destination is applied to any non-empty reverse routing path
of the message, as follows:
- If the incoming message has a non-empty reverse routing path (indicating
that a reply is expected), the value of the Reply destination property
of the destination is added to front of the reverse routing path in
the message (indicating that the reply message must visit this new
reply destination before any destinations that are already in the
reverse routing path).
- If the incoming message has an empty reverse routing path (indicating
that a reply is not expected), the reverse routing path is left unchanged.