Header Based Routing
Route receiving messages based on a pre-configured header value

Use Case Description

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

Proposed Solution

University XYZ, 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 it couldn’t find matching a matching department or the received department doesn’t have it’s 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 doesn’t 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,
  • Computer Science Department - http://localhost:9000/service/department/computer-science This service returns scores of each requested subject and calculates GPA score for given subjects based on the a specific approach for Computer Science field
  • Electronics Department - http://localhost:9000/service/department/electronics This service returns scores of each requested subject and calculates GPA score for given subjects based on the a specific approach for Electronic field
  • Legacy Endpoint - http://localhost:9290/service/getResults This service only returns scores of each requested subject. Since it’s not fair to calcuate in a generic way, this service doesn’t return a GPA value.

Version 17.07
Vendor AdroitLogic
Difficulty Intermediary

Documentation
External documentation for this sample project

Source Code
Full source code of this sample project

Contact Us