WSO2 Enterprise Integrator (WSO2 EI) is a comprehensive solution that allows you to seamlessly integrate applications, services, data, and business processes to support modern enterprise integration requirements.
Routing requests based on message content
This is a 5-minute guide to give you a quick overview of how WSO2 EI mediates and routes messages from a front-end service (client) to a back-end service.
Before you begin,
Get a free trial subscription that enables you to download the product with the latest updates. Then, download the product installer from here, and run the installer.
Let's call the installation location of your product the <EI_HOME> directory. This is located in a place specific to your OS as shown below:
OS Home directory Mac OS /Library/WSO2/EnterpriseIntegrator/6.4.0
Windows C:\Program Files\WSO2\EnterpriseIntegrator\6.4.0\
Ubuntu /usr/lib/wso2/EnterpriseIntegrator/6.4.0
CentOS /usr/lib64/EnterpriseIntegrator/6.4.0
- Ensure that you install updates using WSO2 Update Manager to get the latest fixes.
- Download and start the back-end service that will process appointment requests:
- Download the back-end service and copy it to the
<EI_HOME>/wso2/msf4j/deployment/microservices
directory.
The back-end service is now deployed in the MSF4J profile, which will run microservices for your integration flows. Start the MSF4J profile:
Open a terminal and execute the following command:
wso2ei-6.4.0-msf4j
Go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.4.0 MSF4J. This will open a terminal and start the MSF4J profile.
- Download the back-end service and copy it to the
- If you are on a Windows OS, install cURL. For more information, see the cURL Releases and Downloads.
Let's get started!
Configuring WSO2 EI
Start the ESB profile:
The WSO2 EI product consists of many profiles. The ESB profile is used to manage short-running and stateless integration. For more information, see the WSO2 EI Overview.
Open a terminal and execute the following command:
wso2ei-6.4.0-integrator
Go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.4.0 Integrator. This will open a terminal and start the ESB profile.Open the ESB profile Management Console using
https://localhost:9443/carbon
, and log in using admin as the username and the password.The Management Console provides a UI to configure WSO2 EI. WSO2 Carbon is the core platform on which WSO2 middleware products are built.
Download the
SampleServicesCompositeApplication_1.0.0.car
file from GitHub.Deploy the
SampleServicesCompositeApplication_1.0.0.car
as follows:- On the Main tab of the Management Console, go to Manage > Carbon Applications and click Add.
Click Choose File, select the
SampleServicesCompositeApplication_1.0.0.car
file that you downloaded, and click Upload.Refresh the page to see the Carbon application you just added in the Carbon Applications List screen.
Sending requests to WSO2 EI
We are now ready to request a doctor's appointment at Grand Oak Community Hospital.
Create a JSON file named
request.json
with the following payload to specify the details the back-end service needs to make the appointment: patient information, doctor name, hospital name, and appointment date.{ "patient": { "name": "John Doe", "dob": "1940-03-19", "ssn": "234-23-525", "address": "California", "phone": "8770586755", "email": "[email protected]" }, "doctor": "thomas collins", "hospital": "grand oak community hospital", "appointment_date": "2025-04-02" }
If you want to request a different hospital, you can specify one of the following hospital names instead.
clemency medical center
pine valley community hospital
Open a terminal, navigate to the directory where you have saved the
request.json
file, and execute the following cURL command.curl -v -X POST --data @request.json http://localhost:8280/healthcare/categories/surgery/reserve --header "Content-Type:application/json"
This command sends the JSON payload you created in the previous step to the API resource
http://localhost:8280/healthcare/categories/surgery/reserve
, which was included in the CAR file you uploaded. The API resource contains the logic for routing appointment requests to the back-end service you deployed in the microservices directory.You get the following response:
{"appointmentNumber":1,"doctor":{"name":"thomas collins","hospital":"grand oak community hospital","category":"surgery","availability":"9.00 a.m - 11.00 a.m","fee":7000.0},"patient":{"name":"John Doe","dob":"1940-03-19","ssn":"234-23-525","address":"California","phone":"8770586755","email":"[email protected]"},"fee":7000.0,"confirmed":false,"appointmentDate":"2025-04-02"}
Now check the terminal window and you see the following message:
INFO - LogMediator message = Routing to grand oak community hospital
Congratulations, you have successfully completed this guide!
In this tutorial, you have seen how you can create a request payload and send it to an endpoint in WSO2 EI, which routes the message to a back-end service and then sends a response back to the client.
- For more information on the artifacts used in the section, try out the Routing Requests Based on Message Content tutorial.
- Want to know more and evaluate WSO2 EI further? See the Other capabilities of WSO2 EI section given below.
Other capabilities of WSO2 EI
Try out the following use cases to understand other capabilites of WSO2 EI.
Exposing a datasource as a service
Guaranteeing message delivery
Defining a BPMN process
Additional
- In comparison with the conventional ESB profile, the start-up time of the Micro Integrator profile is considerably less, which makes it container-friendly, and thereby, is ideal to use it for microservices in a container-based environment. For more information, try out the Sending a Simple Message to a Service Using the Micro Integratortutorial.
- Work with WSO2 EI connectors.
- For all the connectors supported by WSO2 EI, see WSO2 ESB Connectors.
- Use the Gmail connector in WSO2 EI by trying out the Using the Gmail Connector tutorial.
- All the CAR files that were used in this tutorial was developed using EI Tooling. You can try it out by following the tutorials listed under Integration Tutorials.
- Use the EI Analytics to analyze the mediation statistics. For more information, try out the tutorial on Using the Analytics Dashboard.