Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 8 Routing : Routing Key

Routing Key
A routing key is used by the Core Engine to select a target operation or target operation group for an incoming facade request. Therefore, the routing key is a key factor to route a facade request for processing. Based on the routing key, a facade request can be routed to any target operation or target operation group.
TIBCO API Exchange Gateway uses routing key in one of the following ways:
By default, the default routing key is provided.
A routing key is extracted from the parsing of the facade request message using the transformation (XSLT) files. You can conditionally evaluate the facade request message and parse the data content as well as the context of the request message. To derive a routing key, define a transformation file in the parsing step of the request processing pipeline.
If no routing key is derived from the parsing of the request message and no preferred routing key is configured, default routing key is used.
The routing key can have the following values:
default: default routing key is used:
if the ProcessBody transform field for a facade operation does not generate a routing key.
if the routing key derived from custom XSLT or specified in Preferred Routing Key field for a facade operation is not configured in the Routing tab.
routingKeyValue: indicates a specific value of the routing key derived from an XSLT file. The routingKeyValue is a value populated from the transformation (XSLT) file using the routingKey element tag.
Preferred Routing Key: a specific value specified in the Preferred Routing Key field of PARTNER > Facade Access tab.
Routing Key using XSLT
If you want to use a custom (non-default) routing key to route a facade request to an appropriate target operation or target operation group, follow these main steps:
To derive a routing key, define a XSLT file with routingKey element tag and upload this XSLT file in the ProcessBody transform field for a facade operation configuration. In such a case, the incoming facade operation request is parsed as per the defined XSLT file and a routing key is returned. After the routing key is populated from the transformation, the Core Engine checks the routing key configuration to determine the target operation or target operation group for a facade operation request. The routing key configuration contains the routing key, the facade operation name, and the target operation name or target operation group name and is configured in the Routing tab of the Config UI. See How to Derive and Configure Routing Key for details.
How to Derive and Configure Routing Key
Follow these steps to derive and configure a routing key:
 
Task A Define a Transformation File
You should define a transformation (XSLT) file that contains the routingKey element tag to populate the routing key.
See the following references:
See Routing Schema document as a reference to the XSLT file schema for the routing key.
Routing Schema document
In the request processing pipeline of a facade operation request, the input document to the XSLT file for parsing the facade request is defined by the following schema:

 
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<xs:element name="transformation" type="transformationType"/>
<xs:complexType name="transformationType">
<xs:sequence>
<xs:element name="nbRequest" type="stageType" minOccurs="0"/>
<xs:element name="cnRequest" type="stageType" minOccurs="0"/>
<xs:element name="sbRequest" type="stageType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="sbResponse" type="stageType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="cnResponse" type="stageType" minOccurs="0"/>
<xs:element name="nbResponse" type="stageType" minOccurs="0"/>
<xs:element name="context" type="stageType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="stageType">
<xs:attribute name="href" type="xs:string"/>
</xs:complexType>
</xs:schema>

 
Example XSLT File to Derive Routing Key
Refer to the following transformation (XSLT) file shipped with the GetLocation example:
ASG_CONFIG_HOME/GetLocation/xslt/operations/parse_getLocation.xml
The example illustrates that the routing key is populated based on the value of opCoId, which is derived as a substring of the address element in the request message.

 
<routingKey>
<xsl:choose>
<xsl:when test="$opCoId != ''"><xsl:value-of        select="$opCoId"/></xsl:when>
<xsl:otherwise>undefined</xsl:otherwise>
</xsl:choose>
</routingKey>

 
Task B Click the ROUTING Tab
1.
2.
3.
4.
Click the ROUTING tab on the upper right.
Task C Upload the Transformation (XSLT) File
To upload the XSLT transformation file for a facade operation request, follow these steps:
1.
Ensure that you are on the ROUTING tab of the Config UI. See Click the ROUTING Tab.
2.
Click the Facade Operations tab on the top menu.
3.
4.
a.
Click the Choose File button in the New ProcessBody Transform field to select a XSLT transformation file.
b.
Click the Open button to upload the XSLT file.
If the XSLT file is located in the ASG_CONFIG_HOME/ASGConfigName/xslt/operations directory, select the XSLT file in the ProcessBody Transform field.
If the New ProcessBody Transform or ProcessBody Transform field of the facade operation configuration contains no XSLT file or has an XSLT file with no routingKey element tag, the Core Engine uses the Routing configuration with the default routing key.
5.
Task D Routing Configuration
You can configure the routing key to map a facade request to a target operation or a target operation group using the ROUTING > Routing tab of the Config UI as follows:
Routing Configuration for a Target Operation
To configure the routing key for a target operation, follow these steps:
1.
Ensure that you are on the ROUTING tab of the Config UI. See Click the ROUTING Tab.
2.
Click the Routing tab on the top menu.
3.
Select Target Operation to route the facade request to a target operation.
4.
Routing Configuration for a Target Operation Group
To configure the routing key for a target operation group, follow these steps:
1.
Ensure that you are on the ROUTING tab of the Config UI. See Click the ROUTING Tab.
2.
Click the Routing tab on the top menu.
3.
Select Target Operation Group to route the operation request to a target operation group. The target operation group is a group of the target operations.
4.

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved