Microgateway 10.7 | webMethods Microgateway Help | Policies | Routing | Conditional Routing
 
Conditional Routing
If you have a native API that is hosted at two or more endpoints, you can use the conditional protocol to route specific types of messages to specific endpoints. The requests are routed according to the conditional routing rules you create. For example, if your entry protocol is HTTP or HTTPS, you can select conditional routing. A routing rule specifies where requests should be routed to, and the criteria by which they should be routed to the specified URL. In addition, you may specify how to authenticate the incoming requests.
The table lists the properties that are supported for this policy in Microgateway:
Parameter
Description
Default Route To. Specifies the URLs of two or more native services in a pool to which the requests are routed.
Endpoint URI
Specifies the URI of the native API endpoint to route the request to in case all routing rules evaluate to False. Service registries that have been added to the Microgateway instance are also included in the list.
Note:
Only simple aliases, endpoint aliases, and service registry aliases are supported in Microgateway.
If you choose a service registry, Microgateway sends a request to the service registry to discover the IP address and port at which the native service is running. Microgateway replaces the service registry alias in the Endpoint URI with the IP address and port returned by the service registry.
For example, if your service is hosted at the URL: http://host:port/abc/, you need to configure the Endpoint URI as: http://${ServiceRegistryName}/abc/.
HTTP Method
Specifies the available routing methods: GET, POST, PUT, DELETE, and CUSTOM (default).
When CUSTOM is selected, the HTTP method in the incoming request is sent to the native service. When other methods are selected, the selected method is used in the request sent to the native service.
Note:
Software AG recommends to use Request Transformation > Method Transformation to achieve this as other transformations can also be done under the same policy.
HTTP Connection Timeout (seconds)
Specifies the time interval (in seconds) after which a connection attempt times out.
The precedence of the Connection Timeout configuration is as follows:
1. If you specify a value for the Connection timeout field in routing endpoint alias, then the Connection timeout value specified in the Endpoint alias section takes precedence over the timeout values defined at the API level and the global level.
2. If you specify a value 0 for the Connection timeout field in routing endpoint alias, then Microgateway uses the value specified in the Connection timeout field in the routing protocol processing step of an API. The Read Timeout value specified at an API level takes precedence over the global configuration.
3. If you specify a value 0 or do not specify a value for the Connection timeout field in the routing protocol processing step at the API level or specify a value 0 at an alias level, then Microgateway uses the value specified in this pg.endpoint.connectionTimeout property.
4. If you do not specify any value for pg.endpoint.connectionTimeout, then Microgateway uses the default value of 30 seconds.
Read Timeout (seconds)
Specifies the time interval (in seconds) after which a socket read attempt times out.
The precedence of the Read Timeout configuration is as follows:
1. If you specify a value for the Read timeout field in routing endpoint alias, then the Read timeout value specified in the Endpoint alias section takes precedence over the timeout values defined at the API level and the global level.
2. If you specify a value 0 for the Read timeout field in routing endpoint alias, then Microgateway uses the value specified in the Read Timeout field in the routing protocol processing step of an API. The Read Timeout value specified at an API level takes precedence over the global configuration.
3. If you specify a value 0 or do not specify a value for the Read timeout field in the routing protocol processing step at the API level or specify a value 0 at an alias level, then Microgateway uses the value specified in this pg.endpoint.readTimeout property.
4. If you do not specify any value for pg.endpoint.readTimeout, then Microgateway uses the default value of 30 seconds.
SSL Configuration. Specifies values to enable SSL client authentication that Microgateway uses to authenticate incoming requests for the native API.
Keystore Alias
Specifies the keystore alias that is present in the system-settings.yml. This value (along with the value of Client Certificate Alias) is used for performing SSL client authentication.
Key Alias
Specifies the alias for the private key, which must be stored in the keystore specified by the keystore alias.
Service Registry Configuration
Service Discovery Endpoint Parameter
Values required for constructing the discovery service URI.
*Parameter: An alias that you have included in the discovery service URI while adding the service registry to Microgateway.
*Value: A value for the path parameter. The alias specified in Path Parameter is substituted with this value when invoking the discovery service.
For example: if the service registry configuration of the service registry that you have selected in Endpoint URI has Service discovery path set to /catalog/service/{serviceName} (and the {serviceName} alias is intended for passing the service name), you must provide {serviceName} as Parameter and the name of the service as Value.
Rule. Defines the routing decisions based on one of the following routing options.
Name
Specifies the name for the rule.
Condition Operator
Specifies the condition operator to be used.
The operators can be one of the following operators:
*OR. Specifies that one of the set conditions should be applied.
*AND. Specifies all the set conditions should be applied.
Condition
Specify the context variables for processing client requests.
Variable
Select any of the following variables:
*Consumer. Specifies the name of the consumer application in the text box.
*Variable Value. Specifies a value in the Variable Value text box.
*Date
*Operator. Specifies one of the following operators: After or Before .
*Variable Value. Specifies a date value.
*IPV4. Specifies that IP version to be IPV4.
*From IP.Type an IP address range.
*To IP. Type an IP address range.
*IPV6. Specifies that IP version to be IPV4.
*From IP. Type an IP address range.
*To IP. Type an IP address range.
*Predefined Context Variable
*Predefined Context. Specifies a predefined context.
*Operator. Select one of the following operators: Equal To or Not Equal To.
*Variable Value. Specifies a value for the selected predefined context.
*Time
*Operator. Specifies one of the following operators: After or Before.
*Hours. Specifies a time value in hours.
*Minutes. Specifies a time value in minutes.
Route To. Specifies the endpoint URI of native services in a pool to which the requests are routed.
Endpoint URI
Specifies the URI of the native API endpoint to route the request to. You can use service registries in a similar manner as described in the main Endpoint URI above.
HTTP Method
Specifies the available routing methods: GET, POST, PUT, DELETE, and CUSTOM (default).
When CUSTOM is selected, the HTTP method in the incoming request is sent to the native service. When other methods are selected, the selected method is used in the request sent to the native service.
HTTP Connection Timeout (seconds)
Specifies the time interval (in seconds) after which a connection attempt times out.
The precedence of the Connection Timeout configuration is as follows:
1. If you specify a value for the Connection timeout field in routing endpoint alias, then the Connection timeout value specified in the Endpoint alias section takes precedence over the timeout values defined at the API level and the global level.
2. If you specify a value 0 for the Connection timeout field in routing endpoint alias, then Microgateway uses the value specified in the Connection timeout field in the routing protocol processing step of an API. The Read Timeout value specified at an API level takes precedence over the global configuration.
3. If you specify a value 0 or do not specify a value for the Connection timeout field in the routing protocol processing step at the API level or specify a value 0 at an alias level, then Microgateway uses the value specified in this pg.endpoint.connectionTimeout property.
4. If you do not specify any value for pg.endpoint.connectionTimeout, then Microgateway uses the default value of 30 seconds.
Read Timeout (seconds)
Specifies the time interval (in seconds) after which a socket read attempt times out.
The precedence of the Read Timeout configuration is as follows:
1. If you specify a value for the Read timeout field in routing endpoint alias, then the Read timeout value specified in the Endpoint alias section takes precedence over the timeout values defined at the API level and the global level.
2. If you specify a value 0 for the Read timeout field in routing endpoint alias, then Microgateway uses the value specified in the Read Timeout field in the routing protocol processing step of an API. The Read Timeout value specified at an API level takes precedence over the global configuration.
3. If you specify a value 0 or do not specify a value for the Read timeout field in the routing protocol processing step at the API level or specify a value 0 at an alias level, then Microgateway uses the value specified in this pg.endpoint.readTimeout property.
4. If you do not specify any value for pg.endpoint.readTimeout, then Microgateway uses the default value of 30 seconds.
SSL Configuration
Specifies values to enable SSL client authentication that Microgateway uses to authenticate incoming requests for the native API.
Provide the following information:
*Keystore Alias. Specifies the keystore alias that is present in the system-settings.yml. This value (along with the value of Client Certificate Alias) is used for performing SSL client authentication.
*Key Alias. Specifies the alias for the private key, which must be stored in the keystore specified by the keystore alias.
Service Registry Configuration
Service Discovery Endpoint Parameter
Values required for constructing the discovery service URI.
*Parameter. An alias that you have included in the discovery service URI while adding the service registry to Microgateway.
*Value. A value for the path parameter. The alias specified in Path Parameter is substituted with this value when invoking the discovery service.
For example: if the service registry configuration of the service registry that you have selected in Endpoint URI has Service discovery path set to /catalog/service/{serviceName} (and the {serviceName} alias is intended for passing the service name), you must provide {serviceName} as Parameter and the name of the service as Value.