Use the RouteToLabel node in combination with one or more Label nodes to dynamically determine the route that a message takes through the message flow, based on its content.
This topic contains the following sections:
The RouteToLabel node interrogates the local environment of the message to determine the identifier of the Label node to which to route the message.
You must precede the RouteToLabel node in the message flow with a Compute node that populates the local environment of the message with the identifiers of one or more Label nodes that introduce the next sequence of processing for the message. The destinations are set up as a list of label names in the local environment tree in a specific location. This excerpt of ESQL from the Airline Reservations sample demonstrates how to set up the local environment content in a Compute node:
IF InputRoot.XMLNSC.PassengerQuery.ReservationNumber<>'' THEN
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelName = 'SinglePassenger';
ELSE
SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelName = 'AllReservations';
END IF;
The label names can be any string value, and can be specified explicitly in the Compute node, taken or cast from any field in the message, or retrieved from a database. A label name in the local environment must match the Label Name property of a corresponding Label node.
When you configure the Compute node, you must also select a value for the Compute Mode property from the list that includes LocalEnvironment.
Design your message flow so that a RouteToLabel node logically precedes one or more Label nodes in a message flow, but do not physically wire the RouteToLabel node with a Label node. The connection is made by the broker, when required, according to the contents of the local environment.
The RouteToLabel node is contained in the Routing drawer of the palette, and is represented in the IBM® Integration Toolkit by the following icon:
You can view information about samples only when you use the product documentation that is integrated with the IBM Integration Toolkit or the online product documentation. You can run samples only when you use the product documentation that is integrated with the IBM Integration Toolkit.
When you have put an instance of the RouteToLabel node into a message flow, you can configure it; see Configuring a message flow node. The properties of the node are displayed in the Properties view. All mandatory properties for which you must enter a value are marked with an asterisk.
The RouteToLabel node terminals are described in the following table.
Terminal | Description |
---|---|
In | The input terminal that accepts a message for processing by the node. |
Failure | The output terminal to which the message is routed if a failure is detected during processing. |
The following tables describe the node properties. The column headed M indicates whether the property is mandatory (marked with an asterisk if you must enter a value when no default is defined); the column headed C indicates whether the property is configurable (you can change the value when you add the message flow to the BAR file to deploy it).
The RouteToLabel node Description properties are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Node name | No | No | The node type: RouteToLabel | The name of the node. |
Short Description | No | No | A brief description of the node. | |
Long Description | No | No | Text that describes the purpose of the node in the message flow. |
The RouteToLabel node Basic properties are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Mode | Yes | No | Route To Last | This property controls how the RouteToLabel node processes
the items in the local environment that is associated with the current
message . Valid values are:
|
Property | M | C | Default | Description |
---|---|---|---|---|
Events | No | No | None | Events that you have defined for the node are
displayed on this tab. By default, no monitoring events are defined
on any node in a message flow. Use Add, Edit,
and Delete to create, change or delete monitoring
events for the node; see Configuring monitoring event sources using monitoring properties for details. You can enable and disable events that are shown here by selecting or clearing the Enabled check box. |