The batch requests feature allows you to send multiple (IN-Only) requests to a datasource using a single operation (batch operation). Follow the steps given below to define a data service that can invoke batch requests:
...
Start the WSO2 ESB profile.
Panel borderColor #542989 bgColor #ffffff borderWidth 1 Localtabgroup Localtab active true title On MacOS/Linux/CentOS Open a terminal and execute the following command:
Code Block wso2ei-6.46.0-integrator
Localtab title On Windows Go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.46.0 Integrator. This will open a terminal and start the ESB profile. - Open the ESB profile's Management Console using
https://localhost:9443/carbon
, and log in usingadmin
as the username and the password. - Click Data Service > Create.
- Add a name for the data service, such as
BatchRequestDataService
. - Select the Enable Batch Requests check box.
- Click Next and add a new datasource.
Give an ID for the datasource, and create the connection to the Company database.
Datasource ID Datasource Datasource Type RDBMS Datasource Type (Default/External) Leave Default selected. Database Engine MySQL Driver Class com.mysql.jdbc.Driver
URL jdbc:mysql://localhost:3306/Company
User Name Enter your MySQL server's username. Password Enter your MySQL server's password.
If you have not assigned a password, keep this field empty.Example:
- Save the datasource details, and click Next to open the Queries screen.
Click Add New Query to specify the query details:
Enter addEmployeeQuery as the query ID.
Enter the following SQL dialect:
Code Block insert into Employees (EmployeeNumber, FirstName, LastName, Email, JobTitle, OfficeCode) values(:EmployeeNumber,:FirstName,:LastName,:Email,:JobTitle,:Officecode)
Click Generate Input Mapping and input mappings will be generated automatically for the EmployeeNumber, FirstName, LastName, Email, JobTitle, and OfficeCode fields.
Save the query, and click Next to open the Operations screen.
- Click Add New Operation, and create an operation for the addEmployeeQuery query as shown below.
- Save the operation.
- Click Finish to complete the data service creation process.
...