Library Link To Toggle Frames Print Feedback

Defining the Route

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.

Specifying the Chained UMO to Use in the Route

To set up the chained UMOs used in a chained route you provide two pieces of information about the UMO:

  1. The URI of the chained UMO.

  2. The class which implements the chained UMO.

Specifying a UMO's URI

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.

Table 7.1. endpoint-identifier Attributes for Specifying a UMO's URI

Attribute Description
name Specifies a unique name that is used throughout the route definition to identify the chained UMO.
value Specifies the URI of the chained UMO.

[Tip] Tip

You can, as shown in the provided chained routing sample, run the chained UMOs in process with the router. When doing so, you contact the UMO using the VM transport. VM transport URIs are specified in the form vm://message.address.

Specifying a Chained UMO's implementation class

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:

  1. Add a mule-descriptor element.

    [Note] Note

    The value of the name attribute should be descriptive but can be any string.

  2. Enter the name of the UMO's implementation class as the value of the mule-descriptor element's implementation attribute.

  3. Add an inbound-router child element to the mule-descriptor element.

  4. Add an endpoint child element to the inbound-router element.

  5. 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.

Configuring the Outbound Router

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.

Specifying the outbound router's implementation class

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>

Adding the chained UMOs to the route

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.