Dynamic Routing using IBM DataPower Gateway
Route action is used to set the backend destination for dynamic routing scenarios.
A processing policy provides route actions to select destinations.
Not only message types but also there will be protocol based back ends in that scenario Data Power routes the request based on the type of request protocol either it may be https, http or MQ whatever it may be.
A matching rule determines whether candidate traffic is subject to a processing rule in a processing policy.
A processing rule specifies the processing actions to apply to incoming documents.
- Adding a route with style sheet action
using dp:set-target() or by setting ‘var://service/routing-url’ in style sheet.
This can be used for all services, except the B2B gateway.
- Drag the Routeicon to the configuration path.
- Double-click the Route
- In the Inputfield, specify the context of the message to process.
- In the Transform Filefield, specify the location of the style sheet for the action.
- If the style sheet is in the store:or local:directory, select the stylesheet.
- Set the Asynchronousproperty to indicate whether to process asynchronously.
- When enabled, the action does not need to complete before the rule starts processing its next action.
- In the Outputfield, specify the context of the message after processing.
- Click Done.
Examples of Routing Stylesheets:
(You’ll have corresponding xml files to the respective stylesheets)
Let’s take a look how the routing happens in the environment.
- To test it, at first you need to create 2 loopback services for making it as a backend.(let us considers those 2 services are xml firewall loopback services and acts as backend)
- Create a service in which routing is going to happen.(Consider this is an mpgw service which acts as a frontend)
- The stylesheets are written in a way that based on the request URI route should be happen.
- The processing policy is shown below.
- Adding a route with variables action
action that performs dynamic, variable-based routing to select the destination.
- In the destination section dropdown will have many options like Remote, Local Files…etc.
- If we have any static dynamic backend URL which is of http protocol then select “http” in remote options and enter the IP and Port in the below section as shown below.
- Adding a route with XPath expression action
action that performs XPath expression-based routing to select the destination.
- Select – Use XPath to Select Destination
- Add – XPath Routing Map
- After giving a name to it go to Rules and configure the Endpoint in the Remote Host and Remote Port.