Skip to content
CA API Gateway - 9.3
Documentation powered by DocOps

Create Routing Strategy Assertion

Last update May 16, 2017

The Create Routing Strategy assertion is used to create routing strategies that form the foundation of dynamic routing.

In this assertion, you configure a route list that contains a list of route destinations. These destinations are usually multi-valued variables that store a list of the possible servers at the back end. The assertion then parses the destination servers and creates a route list that is stored in another variable that is used by the Execute Routing Strategy Assertion and Process Routing Strategy Result Assertion.

Note: The Create Routing Strategy assertion must precede the Execute Routing Strategy Assertion and Process Routing Strategy Result Assertion. Before creating a route, see Working With Dynamic Routing.

Context Variables Created by This Assertion

The Create Routing Strategy assertion sets the following context variables with the query results.

Variable

Description

$<strategy>.routeList 

This returns the list of routes from the Route List table in a multivalued context variable, where <strategy>is the value entered in the Routing Strategy Prefix field. You can access items within this multivalued variable using the ${<strategy>.routeList.<index>} syntax. This variable is set only for outbound messages.

Example: Using the sample route data, assume that the route specified by the variable ${jdbcQuery.servers} resolves to: server 1, server 2. Based on the default Routing Strategy Prefix strategy, the multivalued variable ${strategy.routeList} will be created that contains the following values.

invalid
server1
server2 

${<strategy>} 

This context variable is created using the value entered in the Routing Strategy Prefix field. For example, based on the default value strategy, the context variable that is created is named ${strategy}. This context variable returns the chosen routing strategy and is used by the Execute Routing Strategy and Process Routing Strategy Result assertions. This variable is set only for outbound messages.

Using the Assertion

  1. Do one of the following:
    • To add the assertion to the Policy Development window, see Add an Assertion.
    • To change the configuration of an existing assertion, proceed to step 2 below.
  2. Right-click "Create Routing Strategy..." in the policy window and then select Create Routing Strategy Properties or double-click the assertion in the policy window. The assertion properties are displayed. 
  3. Choose a task to perform.

    To...

    Do this...

    Add a new Route

    1. Click [Add]. The New Route dialog is displayed.
    2. Enter a route name.
    3. Configure the route properties.
    4. Click [OK].

    Clone an existing Route

    1. Select route to clone.
    2. Click [Clone]. The Clone Route dialog is displayed.
    3. Modify the route name and properties as required.
    4. Click [OK].

    Edit an existing Route

    1. Select route to edit.
    2. Click [Edit]. The Edit Route dialog is displayed.
    3. Modify the route name and properties as required.
    4. Click [OK].

    Remove a Route

    1. Select route to remove.
    2. Click [Remove]. You are prompted to confirm.
    3. Click [Remove] to confirm.

    Move Up

    Move the selected route up one line.

    Move Down

    Move the selected route down one line.

    Failover

    Choose a failover from the drop-down list.

    • Ordered Sticky with Failover: The CA API Gateway sends service messages to the first route in the list until the route does not respond (fails). When this occurs, the next route in the list is used.

      Tip: The cluster property io.failoverServerRetryDelay controls the delay before the CA API Gateway retries a failed server. The default is to wait 15 minutes when using the "Ordered Sticky with Failover" strategy.

    • Random Sticky with Failover:  The CA API Gateway chooses a route at random in the beginning of each session and uses it for the duration of the session. If the chosen route fails, another route is randomly selected.
    • Round-Robin: CA API Gateway rotates through the route list sequentially on a request-by-request basis (round-robin), until a valid route is found. If a valid route is not found, and the end of the route list is reached, the cycle stops. See Execute Routing Strategy Assertion.

      Tip: The cluster property io.failoverServerRetryDelay controls the delay before the CA API Gateway retries a failed server. The default is to wait 5 minutes when using the "Round Robin" strategy.

    Caution When Configuring Failover

    Using failover with operations like POST may result in duplicate POST requests being sent from the Gateway to the backend system. For example, the read timeout is 5s. A POST request is sent to Backend1, which takes 10s to answer. This causes the Gateway to send the same POST request to Backend2 after 5 seconds. If there are five backends, this could lead to five POST requests potentially modifying the same backend content five times.

    Failover strategies work well with connection timeouts, but you should avoid using them with non-idempotent operations like POST.

    Configure Failover

    This option is only available with a custom failover.

    Routing Strategy Prefix

    Enter a prefix that will serve two purposes:

    • The value entered here will be added as a prefix to the ${<strategy>.routelist} (shorthand for “${<routingStrategyPrefix>.routelist}”) variable that is created by this assertion.
    • The value entered here will also be used to create its own context variable that will be used to store the chosen strategy.

    The default is strategy.

    For more information these two variables, see "Context Variables Created by This Assertion" above.

    For an explanation of the validation messages displayed, see "Context Variable Validation" in Context Variables..

    To...

    Do this...

    Add a route property

    1. Enter a name in the Route field.
    2. Click [Add]. The New Property dialog appears.
    3. Complete the New Property dialog box as follows.
    • Property Name: Enter the Property Name.
    • Value: Enter the value associated with the Property Name.

    Edit a route property value

    1. Highlight the route in the Route Property and click [Edit]. The Edit Property dialog appears.
    2. Edit the value in the Value field of the Edit Property dialog. This value will appear in the Properties column of the Route List.

    Delete a route property

    1. Highlight the route to delete in the Route Property and then click [Delete]. The route disappears from the Route Properties list in the New Route dialog as well as from the Properties column in the Route List.
  4. Click [OK] when done.
Was this helpful?

Please log in to post comments.