Routing Messages in a Mediation Flow

Route tasks are used to specify that messages can be delivered to different destinations based on values within the message data or within other data in the mediation exchange, such as the security context.

Route tasks enable you to send messages to a specific destination based on conditions that you specify. Data from the mediation exchange, such as the message context or the message body, can be used to construct the routing conditions. For example, you might route incoming messages to a local server from 9:00 a.m. to 5:00 p.m., but outside of those times, route incoming messages to a different server.

An example of using Route Task

The example shows the input path of a system that searches for travel reservations. For the searchHotel mediation operation, incoming messages are routed to the appropriate service, based on the city specified in the search request:

  • If the city is that of the requestor, the message is sent to the QueryGDS service.
  • If the city is in Asia, the message is sent to the QueryGDS_Asia service.
  • If the city is in Europe, the message is sent to the QueryGDS_Europe service.
  • If the city is in the United States, the message is sent to the QueryGDS_US service.
  • A fault is thrown if the city is not the requestor city, or in Asia, Europe, or the United States.

The two types of route taks are, Route and XPath Route.

  • Route task enables you to define basic route conditions.
  • XPath Route task allows more flexibility in the expressions you can use to define a route condition.

The type of condition that you must define determines which route task is appropriate for your application. See Routing Conditions.

Note: If you create Route tasks and later decide that a more complex routing condition is required, you can easily convert the Route task to an XPath Route task. See Changing Route Tasks to XPath Route Tasks.