CentraSite 10.7 | CentraSite User’s Guide | Runtime Governance | Run-Time Policy Management | Built-In Run-Time Actions Reference (CentraSite Business UI) | Built-in Actions for Run-Time Policies (CentraSite Business UI) | Context Based Routing
 
Context Based Routing
If you have a native API that is hosted at two or more endpoints, you can use the Context Based Routing to route specific types of messages to specific endpoints.
When this action is configured for a proxy API, the requests are routed according to the routing rules you create. A routing rule specifies where requests should be routed, and the criteria by which they should be routed there. For example, requests can be routed according to certain clients, certain dates and times, or according to requests that exceed or fall below a specified metric (Total Count, Success Count, Fault Count, and so on). You can create one or more rules.
Input Parameters
Default Route To
(URI). Type the URL of the native API endpoint to route the request to in case all routing rules evaluate to False. For example:
http://mycontainer/creditCheckService
Click the Configure Endpoint Properties icon (next to the Default Route To field) to configure a set of properties for the specified endpoint.
Alternatively, Mediator offers Local Optimization capability if the native endpoint is hosted on the same Integration Server as Mediator. With local optimization, API invocation happens in-memory and not through a network hop.
Specify the native API in either of the following forms:
local://<Service-full-path>
OR
local://<server>:<port>/ws/<Service-full-path>
For example:
local://MyAPIFolder:MyLocalAPI
which points to the endpoint API MyLocalAPI which is present under the folder MyAPIFolder in Integration Server.
Note:
Local Optimization is not applicable to REST APIs.
Add Routing Rule (button)
Click the Add Routing Rule button and complete the Routing Rule dialog box as follows.
Field
Description
Name
Name of the routing rule.
HTTP Methods
The HTTP operations (CUSTOM, DELETE, GET, PATCH, POST, PUT) to perform on the resource.
(TheHTTP Methods list displays the list of supported HTTP methods.)
Condition
The context variables for processing client requests.
TheVariable list displays the list of supported variables - Consumer, Custom Context Variable, Date, IP Address, IPv6 Address, Predefined Context Variable, and Time.
*Consumer - Type the name of the consumer application in the text box.
*Custom Context Variable
*Select a data type - String or Integer.
*Select an operator - Greater Than, Less Than, Not Equal To, or Equal To.
*Type a custom variable name in the Custom Context text box.
*Type a value in the Variable Value text box.
*Date - Select an operator Before or After. Type a date value in the text box.
*Time - Select an operator Before or After. Type a time value in the text box.
*IP Address / IPv6 Address - Type an IP address range in the From and To text boxes.
*Predefined Context Variable
*Select a data type - String or Integer.
*Select an operator - Greater Than, Less Than, Not Equal To, or Equal To.
*Select a predefined context variable from the Predefined Context list.
*Type a value in the Variable Value text box.
Note:
Keep the following points in mind:
*For a list of the predefined context variables, see Context Variables in Virtual Services.
*The predefined context variable PROTOCOL_HEADER is not available in the drop-down list; to include PROTOCOL_HEADER in the rule, define the variable as Custom Context Variable.
*If you define a custom context variable in the routing rule, you must write a webMethods IS service and invoke it in the API's Context Based Routing action. In this Integration Server service, use the API to get or set the custom context variable.
Route To
Type the URL of the Native Service endpoint to route the request to, if the above rule criteria are met.
Configure Endpoint Properties (icon)
Configure the following set of properties for the specified endpoint individually.
Configure Endpoint Properties  (icon)
Optional. This icon displays the Endpoint Properties dialog box that enables you to configure a set of properties for the Mediator to route incoming requests to the native API as follows:
SOAP Optimization Method
Only for SOAP-Based APIs. Mediator can use the following optimization methods to parse SOAP requests to the native API:
Value
Description
MTOM
Mediator uses the Message Transmission Optimization Mechanism (MTOM) to parse SOAP requests to the API.
SwA
Mediator uses the SOAP with Attachment (SwA) technique to parse SOAP requests to the API.
None
Default. Mediator does not use any optimization method to parse the SOAP requests to the API.
Note:
Keep the following points in mind:
*Bridging between SwA and MTOM is not supported. If a client sends a SwA request, Mediator can only forward SwA to the native API. The same is true for MTOM, and applies to responses received from the native API. That is, a SwA or MTOM response received by Mediator from a native API is forwarded to the client using the same format it received.
*When sending SOAP requests that do not contain a MTOM or SWA attachment to a native API that returns an MTOM or SWA response, the request 'Accept' header must be set to multipart/related. This is necessary so Mediator knows how to parse the response properly.
HTTP Connection Timeout
(Optional). (Number). The time interval (in seconds) after which a connection attempt timeouts. If a value 0 is specified (or if the value is not specified), Mediator uses the value specified in the Connection Timeout field (in the Integration Server Administrator, go to Settings > Extended). Default: 30 seconds.
Read Timeout
(Optional). (Number). The time interval (in seconds) after which a socket read attempt will timeout.
The precedence of the Read Timeout configuration is as follows:
1. If a value is specified for the Read Timeout field in the routing endpoint alias, Mediator will use the value specified in the Runtime Alias > Endpoint Alias > Endpoint Properties > Read Timeout field. The read timeout value defined at an alias level takes precedence over the timeout values defined at an API level and the global configuration.
2. If a value 0 is specified (or if the value is not specified) for the Read Timeout field in the routing endpoint alias, then Mediator will use the value specified in the Read Timeout field of this routing action. The read timeout value defined at an API level takes precedence over the global configuration.
3. If a value 0 is specified (or if the value is not specified) for the Read Timeout field in this routing action (at an API level), then Mediator will use the value of the global property pg.endpoint.readTimeout located in the file Integration Server_directory\packages\WmMediator\config\resources\pg-config.properties (in the Mediator Administration console, go to > Settings > Extended Settings > pg.endpoint.readTimeout property.).
Note:
If a value for the Read Timeout configuration is not specified in any of the above configuration parameters, then Mediator will use the default 30 seconds.
SSL Configuration
(Optional). To enable SSL client authentication that Mediator uses to authenticate incoming requests for the native API, you must specify values for both the Client Certificate Alias field and the IS Keystore Alias field. If you specify a value for only one of these fields, a deployment error occurs.
Note:
SSL client authentication is optional; you may leave both fields blank.
Prerequisite: You must set up the key alias and keystore properties in the Integration Server. For the procedure, see webMethods Integration Server Administrator’s Guide.
You uses these properties to specify the following fields:
Value
Description
Client Certificate Alias
The client's private key to be used for performing SSL client authentication.
IS Keystore Alias
The keystore alias of the instance of Integration Server on which Mediator is running. This value (along with the value of Client Certificate Alias) is used for performing SSL client authentication.
WS Security Header
(Only for SOAP-Based APIs). Indicates whether Mediator should pass the WS-Security headers of the incoming requests to the native API.
Value
Description
Remove processed security headers
(Default). Removes the security header if it is processed by Mediator (that is, if Mediator processes the header according to the API's security run-time action). Mediator does not remove the security header if both of the following conditions are true: 1) Mediator did not process the security header, and 2) the mustUnderstand attribute of the security header is 0 or false).
Pass all security headers
Passes the security header, even if it is processed by Mediator (that is, even if Mediator processes the header according to the API's security action).