Header value router
Routes messages to a channel based on a value in the header.
The header name attribute specifies which header value to lookup. That header value can then provide the name of a channel to be resolved. Alternatively, 1 or more 'mapping' sub-elements may be provided with expected header values mapped to channels.
Header name
Name of the header whose value to use.
Examples: busname_messageType busname_sourceSystem
Required
Maps values of the message header to channels.
If the value is not found in a mapping, the router will look for a channel which name matches the value.
Note that if the header contains multiple values (comma-separated string or a string array), this router will route the message to multiple channels (this duplicates the message).
Input channel
Channel to consume the input messages from.
Required
Id
Name that uniquely identifies this flow component.
Required
Resolution required
If set to true and channel resolution fails, a MessageDeliveryException
is thrown. If set to false such failures are (silently) ignored, possibly resulting in the router resolving zero channels.
Channel resolution failure means that the routing criteria cannot be successfully resolved, for example when a header value router tries to route a message with a header value that is not specified in the mappings, or when any of the XPath evaluation results of an XPath router cannot be found in the mappings.
Note that this behaviour does not apply to cases where resolving the routing criteria (successfully) results in zero channels, for example when a header value router tries to route a message that doesn't contain the specified message header, or when the evaluation of the XPath expression by an XPath router produces no results.
Please be aware that instead of suppressing these exceptions, it is also possible to explicitly drop certain messages by routing them to the nullChannel.
Default is true.
Ignore send failures
If set to true, failures to send to a message channel will be ignored. If set to false, a MessageDeliveryException
will be thrown instead, and if the router resolves more than one channel, any subsequent channels will not receive the message.
Please be aware that when using direct channels (single threaded), send-failures can be caused by exceptions thrown by components much further down-stream.
Also note that this behaviour does not apply to the the optional default output channel.
Default is false.
Default output channel
The default channel where messages should be sent if the router didn't send the message to any of the normal output channels.
If no default output channel is provided and the router didn't send the message to any of the normal output channels a MessageDeliveryException
is thrown. If you would like to silently drop those messages instead, use the nullChannel as the default output channel.
A router might not be able to send a message to any of the normal output channels in the following cases:
resolving the routing criteria resulted in zero channels For example, when a header value router tries to route a message that doesn't contain the specified message header, or when the evaluation of the XPath expression by an XPath router produces no results.
resolving the routing criteria failed and 'resolution required' is disabled For example, when a header value router tries to route a message with a header value that is not specified in the mappings, or when all results of the evaluation of the XPath expression by an XPath router cannot be found in the mappings.
all send attempts failed and 'ignore send failures' is enabled For example, when every normal output channel connects to a down-stream filter that rejects the message using the throw exception on rejection option (the "selective consumer" pattern).
Apply sequence
Specify whether sequence number and size headers should be added to each message.
Default is false.
Timeout
Specify the maximum amount of time in milliseconds to wait when sending messages to the target message channels.
By default the send will block indefinitely.