This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc
Skip to end of metadata
Go to start of metadata

Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation:

  • <PRODUCT_HOME>/repository/samples/ directory that includes all Data Integration samples is changed to <EI_HOME>/samples/data-services/.
  • <PRODUCT_HOME>/repository/samples/resources/ directory that includes all artifacts related to the Data Integration samples is changed to <EI_HOME>/samples/data-services/resources/.

In this sample demonstration, we use a data service with batch processing. Batch processing is used when a specific in-only operation must be executed sequentially with different sets of parameters.

Building the sample

The sample data service named BatchRequestSample should be deployed using the instructions in Samples Setup.

Running the sample

The command line application is used here to present the functionality of batch processing. As shown in the Data Services Clients section, execute the "ant batch_request" command to run the sample. The output will resemble the following:

The sample tests batch processing by executing a batch operation with three parameter tests, which means, it effectively executes three consecutive operations. The operation is to add a new employee to the database. Here we execute the batch operation and checks for the existence of the three newly added entries. A requirement of batch operations is, if one invocation fails, then all the other operations in the batch should fail. This can be seen here, where the sets of three employee entries are either inserted together, or none of them are inserted. In this sample, a validator is used for checking if a valid email address is given when adding a new employee entry to the database. If the email is invalid, that operation invocation fails.

In this sample data service, there are four such batch requests executed as explained below.

  1. All the parameters are added properly and all operations executed successfully. Therefore, when checking for entries with ids "180000", "180001", "180002", all returns true.
  2. The request with id "180003" is executed successfully. But when it reaches "180004", a validation error occurs since the email address is invalid. All service invocations in that batch request are rolled back. So in the next section when checking for the employee ids belonging to this batch request, no one would have been added to the database. This is expected since all the operations in a batch operation are executed in a single transaction.
  3. In this instance, the 3rd operation in the batch request is not given an email address. It causes a validation error. The transaction is rolled back and all ids "180006", "180007" and "180008" are not executed.
  4. The requests here are all given valid parameters; same as in the 1st request. So all the records "180009", "180010" and "180011" are added successfully.

This demonstrates how the batch operations behave in a transactional manner.

  • No labels