Introduction to Spring Batch
A lot of corporate applications need bulk processing to carry out business operations in mission-critical settings. These business operations include:
Automated processing of large volumes of data that is best done without user interaction.
Periodic processing of complex business rules over large data sets regularly.
Integration of data received from various internal and external systems, which typically requires validations, formatting and processing in a transactional manner.
Spring Batch is a lightweight, comprehensive batch framework that is designed to develop robust batch applications. It is built upon the characteristics of the Spring Framework.
Spring batch provides reusable functions for processing large volumes of data, including logging/tracing, transaction management, job processing statistics, job restart, skip and resource management. It also provides features to process extremely high-volume and high-performance batch jobs through optimization and portioning techniques.
Spring batch can be used in various use cases such as reading flat files and inserting them into the database, moving a high volume of data from one database to another, and transforming it between two steps.
Spring Batch Architecture
Spring Batch is designed with extensibility and a diverse group of end users in mind. The figure below shows the layered architecture that supports the extensibility and ease of use for end-user developers.
Fig: Spring Batch Layered Architecture
This layered architecture highlights three major high-level components: Application, Core, and Infrastructure. The application contains all batch jobs and custom code written by developers using Spring Batch. The Batch Core contains the core runtime classes necessary to launch and control a batch job. It includes implementations for JobLauncher, Job, and Step. Both Application and Core are built on top of a common infrastructure. This infrastructure contains common readers writers and services (such as the RetryTemplate), which are used both by application developers(readers and writers, such as ItemReader and ItemWriter) and the core framework itself (retry, which is its own library).
Summary
In this article, we learned about the basics of spring batch, what it is used for and what can we do with it. In the coming articles, we will learn about the implementation of spring batch jobs.
Subscribe to my newsletter
Read articles from Shailendra Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Shailendra Singh
Shailendra Singh
๐จโ๐ป Shailendra - Software Engineer ๐จโ๐ป Hello there! I'm Shailendra, a software engineer with five years of invaluable experience in the tech industry. My coding toolkit primarily consists of Java and Spring Boot, where I've honed my skills to craft efficient and scalable software solutions. As a secondary passion, I've dived into the world of React.js to create dynamic and interactive web applications.