In part1 of the blog, I talked about WebSphere Feature Pack for Modern Batch. In part 2, I will introduce Spring Batch framework. Spring batch framework was developed as a standard-based way to implement common batch patterns in Java.
Spring Batch architecture consists of following layers:
Application: This consists of your custom code and configuration of your batch jobs.
Core: This layer contains the core elements of framework including Job and Step interface as well as JobLauncher and JobParameters.
Infrastructure: This layer deals with reading and writing to files and databases.
Note: Spring Batch framework does not include a scheduler. You will need to use external schedulers like cron or Quartz for scheduling jobs at a given time.
Main Components of a Spring Batch Application
Job Repository: Component provided by infrastructure to store job execution data.
Job Launcher: Component provided by infrastructure to start executing a job.
Job: Application component representing a batch job.
Step: A phase in a job, a job usually consists of multiple steps in a sequence.
Tasklet: A transactional process that occurs in a step.
Item: A record read from a data source or a record written to a data source.
Chunk: A certain sized group of items. This is used for chunk processing.
Item Reader: Component responsible for reading items from data source.
Item Writer: Component responsible for writing items to data source.
Item Processor: Component responsible for processing an item before output.
What is a Spring Batch Job?
A batch job in Spring Batch is composed of a sequence of steps configured in XML configuration file. It is easier to develop, maintain, and test a batch job that is divided into multiple steps. Spring Batch framework allows for control flow decisions based on step completed, failed, or any other custom logic like checking a table in database.
Links for further information: