Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

...

  1. Start the WSO2 ESB profile.

    Panel
    borderColor#542989
    bgColor#ffffff
    borderWidth1
    Localtabgroup
    Localtab
    activetrue
    titleOn MacOS/Linux/CentOS

    Open a terminal and execute the following command:

    Code Block
    sudo wso2ei-6.46.0-integrator
    Localtab
    titleOn Windows
    Go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.46.0 Integrator. This will open a terminal and start the ESB profile.
  2. Open the ESB profile's Management Console using https://localhost:9443/carbon, and log in using admin as the username and the password.
  3. Click Data Service > Create.
  4. Add a name for the data service, such as BatchRequestDataService.
  5. Select the Enable Batch Requests check box.
  6. Click Next and add a new datasource.
  7. Give an ID for the datasource, and create the connection to the Company database.

    Datasource IDDatasource
    Datasource TypeRDBMS
    Datasource Type (Default/External)Leave Default selected.
    Database EngineMySQL
    Driver Classcom.mysql.jdbc.Driver
    URLjdbc:mysql://localhost:3306/Company
    User NameEnter your MySQL server's username.
    PasswordEnter your MySQL server's password.
    If you have not assigned a password, keep this field empty.

    Example:

  8. Save the datasource details, and click Next to open the Queries screen.
  9. Click  Add New Query  to specify the query details:

    1. Enter addEmployeeQuery as the query ID.

    2. Enter the following SQL dialect:

      Code Block
      insert into Employees (EmployeeNumber, FirstName, LastName, Email, JobTitle, OfficeCode) values(:EmployeeNumber,:FirstName,:LastName,:Email,:JobTitle,:Officecode)
    3. Click Generate Input Mapping and input mappings will be generated automatically for the EmployeeNumber, FirstName, LastName, Email, JobTitle, and OfficeCode fields.

  10. Save the query, and click Next to open the Operations screen.

  11. Click Add New Operation, and create an operation for the addEmployeeQuery query as shown below.
  12. Save the operation.
  13. Click Finish to complete the data service creation process.

...