WSO2 Enterprise Integrator 6.6.0 (WSO2 EI) is the latest release of the WSO2 EI 6.x.x family. It 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,
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
- Download and start the back-end service that will process appointment requests:
- Download the JAR file of the back-end service.
Open a terminal and navigate to the location where your saved the back-end service.
Execute the following command to start the service:
- 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:
WSO2 EI 6.6.0 consists of many profiles. The ESB profile is used for managing short-running and stateless integrations. For more information, see the WSO2 EI Overview.
Open the ESB profile's Management Console using
https://localhost:9443/carbon, and log in using admin as the username and password.
The management console provides a UI to configure the product profile.
SampleServicesCompositeApplication_1.0.0.carfile from GitHub.Click here to find out what is inside the CAR file
This file is a Carbon Application Archive (CAR file) containing the integration artifacts you will use in this quick start, including:
- An API resource, which acts as the endpoint that accepts incoming requests from a client, routes them to the back-end service for processing, receives a response from the service, and sends the response back to the client.
- A Switch Mediator to route messages based on the message content to the relevant HTTP endpoint defined in the ESB.
- A Log Mediator to log the message stating that the switch mediator is routing the message to the correct endpoint.
- A Send Mediator to send the appointment request to the correct hospital endpoint.
If you want to try out this same guide by configuring the artifacts, try out the tutorial on Routing Requests Based on Message Content.
- 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.carfile 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.jsonwith 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.
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.jsonfile, and execute the following cURL command.
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 get the following response:
Now check the terminal window and you see the following message:
Congratulations, you have successfully completed this guide!
In this quick start, you have created 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.