Its often a requirement to perform content based routing in an ESB. This means you route messages around your service bus based on the message properties or the content of the messages. When integrating systems across language boundaries its common to use XML as a universal message format; so XPath is an ideal tool to perform content based routing and transformation.
We support a XPath based routing and transformation mechanism designed for high performance and power.
The following is an example routing and transformation template. Firstly we reuse the XSLT basd transform component.
Then we provide a file in XSLT format, with some JBI extensions
In the above example, depending on the value of the @id attribute, we invoke different services.
Notice that we declare the jbi namespace and some attributes on the root XSLT stylesheet element. We then have the following extension elements available to the XSTL
The following new XML tags are available in Xalan when working with ServiceMix
Element |
Description |
|---|---|
forward |
will forward the current inbound message to the given service, interface and/or operation. This mechanism will use the properties and content of the inbound message to create the outbound message |
invoke |
will perform a one way service invocation where the body of the invoke tag represents the XML content of the message. Notice from the above we can use XPath expressions to create the XML |
The following example shows a number of services being invoked one after the other, using optionally different properties. In each case the original XML message is used as the body of the new inbound request.
This example demonstrates a message being split into multiple different sections of XML which are then invoked on different services.
We use Xalan to implement our XPath based router and transformation engine. The main reasons for doing so are