Batch Processing is the concept of processing a large number of records into batches. Batch processing can be executed without end-user interaction.
Why do we need Batch Processing?
If a document contains 1000 plus lines and a person wants to read all that File rather than going through the individual record one by one we can generate separate files for him by filtering out the records on some particular basis. By achieving this, the efficiency of a person would increase to process a large number of records. Any MuleSoft developer can easily process a large number of records with the help of batch processing.
How will it help in real-life scenarios?
This concept of batch processing is fantastic in itself. It is the next step to business automation. With the help of MuleSoft, we can process a large number of records parallel and asynchronously just in seconds. We can relate this concept to a few real-time scenarios like:
Processing a single file with all information of registered users with HDFC Bank Credit Card to convert into individual files according to names of the user, that will contain all the information of users shared in the records of the bank in a single file.
Handling large quantities of incoming data from APIs into outdated computer systems, yet still in use.
What will readers achieve after going through this blog?
This blog will facilitate a conceptual understanding of batch processing to MuleSoft developers. After going through this, a person would understand the need and benefits of batch processing and how it is helpful in real-time and how it is a b2b solution. Batch processing would make our work more comfortable and more categorized rather than being a bulk of data.
Step 1: Make sure you have MuleSoft Anypoint studio 7+ installed on your system.
Step 2: Make a new project in your Any point Studio by clicking on File>New>Mule Project.
Step 3: Name your Project as batch_processing_records.
Step 4: Add file module by clicking on add module in the mule pallet as Add Modules>File.
Step 5: Make the desired flow with the required components shown in the flow below.
Step 6: Set various connectors configuration as below.
For the component On New or Updated File set the configurations as below.
For the transform Message component set the configurations as below
Expression in DataWeave 2.0
For the component Set Variable(file_name) set the configurations as below:
For the transform Message component set the configurations as below:
Expression in DataWeave 2.0
For the Write component set the configurations as below:
Batch processing helps to process records at a very high pace. Processing a single record to another in an incremental way takes a lot of time. It is an asynchronous process of processing records and hence improves the entire process’s agility and efficiency.