The topic describes the RouteToLabel node.
This topic contains the following sections:
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. The RouteToLabel node interrogates the LocalEnvironment 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 LocalEnvironment 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 LocalEnvironment tree in a specific location. This excerpt of ESQL from the Airline Reservations sample demonstrates how to set up the LocalEnvironment content in a Compute node:
IF InputRoot.XMLNS.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 LocalEnvironment 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 within 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 LocalEnvironment.
The RouteToLabel node is contained in the Routing drawer of the palette, and is represented in the workbench by the following icon:
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 (those that do not have a default value defined) are marked with an asterisk.
Configure the RouteToLabel node as follows:
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 | 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 within the LocalEnvironment that is associated with the current message |