XPath router
Routes messages based on a XPath expression.
Routes XML messages based on the result of an XPath expression.
The result of the expression is mapped to one or more channels by the XPath value mapping.
Maps result values of the XPath expression 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 XPath expression evaluates to multiple values or the value is a comma-separated string, this router will route the message to multiple channels (this duplicates the message).
Evaluate XPath as string
Specifies if the XPath expression should be evaluated as as String
type instead of NODESET
type.
By default XPath expressions are evaluated as NODESET</code type and then converted to a List of channel names.
Certain XPath expressions may evaluate as String type from the very beginning, e.g.,
name(./node())
which will return the name of the root node).
It results in the exception if default evaluation type (NODESET) is used.
NODESET returns an list<String>
, evaluated as String will return the string value of the first node.
Default: false
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.
Namespace URI of the XML nodes in the XPath expression.
Optional, but required when namespace prefix is set
Example:
XPath expression : /ns1:one/@type
Namespace prefix : ns1
Namespace URI: http://www.example.org
Namespace prefix of the XML nodes in the XPath expression
Optional, but required when namespace URI is set
Example:
XPath expression : /ns1:one/@type
Namespace prefix : ns1
Namespace URI: http://www.example.org
XPath expression that returns a value (boolean or string) used for filtering the message. In case of a boolean value, true
accepts the message and false
discards it. In case of a string value, this decision depends on the value of the match value and match type settings.
Required
Example:
XPath expression : /ns1:one/@type
Namespace prefix : ns1
Namespace URI: http://www.example.org