Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mule batch processing

Batch processing component and how to use / configure the component

  • Login to see the comments

  • Be the first to like this

Mule batch processing

  1. 1.  Batch component is used to process huge messages in batches. In batch we have 3 phases. 1. Input 2. Process Records 3. On complete Input: Input phase is used to prepare a collection object with input message. Because process records phase expects a collection object.
  2. 2. Process Records:  Process Record phase expects a collection object to process the each record of collection in individually and parallel. Here each object of collection is a record. On Complete:  On complete phase is used to summarize the flow. Following variables are available in On Complete phase to get the status of flow. • Count of Successful records • Count of Failure records • Count of total records.
  3. 3. Example:  In the following example, it explains how to transform CSV to XML using batch. This example exposes a HTTP rest service.
  4. 4.  In the main flow input csv file path sets to payload and refer to a batch job.
  5. 5.  In Input phase, an expression component is used to read file (src/main/resources/input.csv) data. This expression component refers to a file (src/main/resources/ReadFile.txt) which has code to read file data. Another expression component has below expression to create a collection object.  payload = new com.techm.common.util.LineIterator(payload);  LineIterator is our custom class which implements Iterator Interface to implement collection object. Below is code of LineIterator class.
  6. 6. Note : Java Code Continuation from line 31 on next slide.
  7. 7.  In Process Records phase, we have two batch steps to transform payload from csv to xml using datamapper and write the xml data into a file. Second batch step contains batch commit. The message processors which are in batch commit scope get execute depends of size of batch commit.  <batch:commit size="5" doc:name="Batch Commit">  This batch commit get executed for every 5 records as configured.  On Complete phase has one logger component which logs successful, failure and total no of records.  Note : SOAP UI project to test this application is placed in src/test/resources.
  8. 8. Thank You All

×