When defining a chained route you need to tell the router which UMOs to load, how they are contacted, and what order they are to be called. You also need to use the chaining outbound router implementation. The information is provided through the router's configuration file. For more information see Chapter 5, Understanding Basic Router Configuration.
To set up the chained UMOs used in a chained route you provide two pieces of information about the UMO:
The first piece of information you need specify about a chained UMO is it URI. You add this information to a route definition using the endpoint-identifiers element.
The endpoint-identifiers element is a wrapper for one or more endpoint-identifier elements. Each endpoint-identifier element specifies the URI of one UMO. The endpoint-identifier element's attributes that are used to specify the information are listed in Table 7.1, “endpoint-identifier Attributes for Specifying a UMO's URI”.
The second piece of information you need to provide about a chained UMO is the name of its implementation class. This is done as part of the model element that describes the route. Each UMO used in a chained route is defined as a route, using the mule-descriptor element, that is made up of a single inbound router.
The route definition for a chained UMO is much simpler than a complete route definition. It only needs to specify the implementation class and URI for the chained UMO. To specify the route for a UMO do the following:
Add a mule-descriptor element.
|
Note |
|---|---|
|
The value of the |
Enter the name of the UMO's implementation class as the value of the mule-descriptor element's implementation attribute.
Add an inbound-router child element to the mule-descriptor element.
Add an endpoint child element to the inbound-router element.
Enter the value of the name attribute of the endpoint-identifier element that specifies the UMO's URI as the value of the endpoint element's address attribute.
For more information, see Specifying a UMO's URI.
The outbound router is responsible for directing messages through all of the endpoints in a chained route. When defining a chained route you need to define the outbound router using the following information:
The chaining outboud router implementation class.
The chained UMOs that are involved in the chained route.
The order in which the chained UMOs are to be invoked.
Chained routes require a special outbound router that passes the messages through each endpoint in the chain. This outbound router is implemented using the org.mule.routing.outbound.ChainingRouter class. You specify this using the router element's className attribute. Example 7.3, “Specifying the Chaining Router Implementation” shows the router element that should be used to define a chained route.
Example 7.3. Specifying the Chaining Router Implementation
<outbound-router>
<router className="org.mule.routing.outbound.ChainingRouter">
...
</router>
</outbound-router>
You specify each of the chained UMOs in a chained route using an endpoint element. In each endpoint element you need to specify values for the attributes listed in Table 7.2, “endpoint Element Attributes for Specifying a Chained UMO”.
Table 7.2. endpoint Element Attributes for Specifying a Chained UMO
| Attribute | Description |
|---|---|
remoteSync
|
The value of this attribute is always true. |
address
|
The value of the name attribute of the endpoint-identifier element that specifies the UMO's URI as the value of the endpoint element's address attribute. See Specifying a UMO's URI for more information. |
The endpoint elements are listed in the order in which you want the chained UMOs invoked.