Header Based Routing

Version: 17.07

Supported Since: 17.01

Use case description

University XYZ, has a legacy students' result calculation service and they have decided to upgrade their system and maintain separate services for each department due to the different procedures they have to follow, in-order to calculate the GPA of the given subjects. Although there are changes in the actual back end, they do not want to introduce this dependency to the front end system and maintain their front end system completely independent of multiple results calculation backend web service end points.

Proposed Solution

University XYZ, has decided to introduce an ESB to mediate their front end calls to respective department wise back end services as shown in below diagram

header based routing diagram1

To solve this problem using header based routing, front end should send the department as a HTTP header for the back end service. Let’s assume that front end sends HTTP requests with custom header xyz-department which contains the department name. ESB will read this xyz-department header from the input request and route the received message to the respective department’s result calculation endpoint. If the ESB fails to find a matching department or the received department does not have its own results calculation endpoint, then the received message will be routed to the legacy results calculation endpoint which is generic for every department, but it does not have the capability of calculating GPA value for the given subjects.

The details of the back end services of each department and the legacy results calculation service is as below,

UltraStudio Configuration

UltraESB-X Configuration

Implementation of the Solution


In order to implement above use case you must first select following dependencies when you are creating an empty Ultra project

  • HTTP NIO Connector dependency from the connector list.

  • Flow Control dependency from the processor list.

If you have already created a project, you can add above dependencies via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list and Processors list, select above dependencies.

To implement above use case, first let’s create our integration flow named “header-based-routing-flow”. Then let’s add required components by going through following steps in order.

  1. Add a HTTP Ingress Connector from the connectors list, to accept the result calculating HTTP messages. HTTP Ingress Connector should be filled as shown below to expose a single web service on port 8280 and under /service/getResults service path to calculate results using above department specific web services and legacy web services.

  2. Add a Switch Case processing element to check the department and select the result calculating endpoint based on the department name. This processing element should look for the value of the transport header with name xyz-department and forward the message to the respective HTTP egress connector. For this, basic parameters of this processing element should be filled as shown below.

  3. Add three Case processing elements for each possible value of the department transport header which should be evaluated at the Switch processing element.

  4. Add three HTTP Egress Connector elements to send message to respective departments results calculation service.

The completed integration flow should look like below.

header based routing complete flow

Configuration for each element is as below. The numbering corresponds to the numbers shown in above diagram.

Design View

Text View


1. HTTP Ingress Connector

header based routing component 1

2. Switch Processing Element

header based routing component 2

3. Case Processing Element

header based routing component 3

4. Case Processing Element

header based routing component 4

5. HTTP Egress Connector