Spring Batch - Overview
Batch processing is a processing mode which involves execution of series of automated complex jobs without user interaction. A batch process handles bulk data and runs for a long time.
Several Enterprise applications require to process huge data to perform operations involving −
Time-based events such as periodic calculations.
Periodic applications that are processed repetitively over large datasets.
Applications that deals with processing and validation of the data available in a transactional manner.
Therefore, batch processing is used in enterprise applications to perform such transactions.
What is Spring Batch
Spring batch is a lightweight framework which is used to develop Batch Applications that are used in Enterprise Applications.
In addition to bulk processing, this framework provides functions for −
- Including logging and tracing
- Transaction management
- Job processing statistics
- Job restart
- Skip and Resource management
You can also scale spring batch applications using its portioning techniques.
Features of Spring Batch
Following are the notable features of Spring Batch −
Flexibility − Spring Batch applications are flexible. You simply need to change an XML file to alter the order of processing in an application.
Maintainability − Spring Batch applications are easy to maintain. A Spring Batch job includes steps and each step can be decoupled, tested, and updated, without effecting the other steps.
Scalability − Using the portioning techniques, you can scale the Spring Batch applications. These techniques allow you to −
Execute the steps of a job in parallel.
Execute a single thread in parallel.
Reliability − In case of any failure, you can restart the job from exactly where it was stopped, by decoupling the steps.
Support for multiple file formats − Spring Batch provides support for a large set of readers and writers such as XML, Flat file, CSV, MYSQL, Hibernate, JDBC, Mongo, Neo4j, etc.
Multiple ways to launch a job − You can launch a Spring Batch job using web applications, Java programs, Command Line, etc.
In addition to these, Spring Batch applications support −
Automatic retry after failure.
Tracking status and statistics during the batch execution and after completing the batch processing.
To run concurrent jobs.
Services such as logging, resource management, skip, and restarting the processing.