Spring Book – Chapter 21 – Spring Batch

Spring Batch Architecture

Spring Batch is based on layered architecture focusing on extensibility and diverse group of end users in mind. The layered architecture consists of three main components namely: Application, Batch Core along with Batch environment and Infrastructure as show in Figure 23-2 below.

Figure 23-2. Spring Batch architecture

Figure 23-2. Spring Batch architecture

The various components in Spring Batch framework can be summarized as below:

  • Application contains all batch jobs and custom code written by developers using Spring Batch.
  • Batch core conmtains the core runtime classes necessary to launch and control a batch job. It includes things such as a JobLauncher, Job and Step implementations.
  • Batch Infrastructure contains common readers and writers, and services which are used both by application developers and the core framework itself.

Spring Batch Dependency

Spring Batch’s dependency can be pictorially depicted as shown in Figure 23-3 below.

Figure 23-3. Spring Batch dependency

Figure 23-3. Spring Batch dependency

Spring Batch Domain

To understand and comprehend Spring Batch better you need to first understand the various concepts and terminologies used in a typical batch program especially with respect to Spring Batch. This section aims at bringing the concepts to the table as these are very much essential for understanding the following sections of this Chapter. Please have a look at the Figure 23-4 below closely.

 Figure 23-4. Key concepts that make up the domain language of batch

Figure 23-4. Key concepts that make up the domain language of batch

In simple terms Figure 23-4 can be explained as follows:

  • Its JobLauncher’s responsibility to launch a Job
  • A Job is an entity which comprises of multiple Step’s
  • Each Step can have exactly one ItemReader, ItemProcessor and ItemWriter
  • All the required meta-data about the current running process is stored in the JobRepository

Before going through the working of Spring Batch in detail, I would like you to go through the Spring Batch domain objects as explained in the following sections so that you can relate the various domain objects in this diagram completely. While explaining each domain object we will be looking into as to how it fits into Figure 23-4 above. After going through this section, come back and have a look at the Figure 23-4 above and I am sure you will comprehend it much easily.

Page Visitors: 25402

The following two tabs change content below.
Tomcy John

Tomcy John

Blogger & Author at javacodebook
He is an Enterprise Java Specialist holding a degree in Engineering (B-Tech) with over 10 years of experience in several industries. He's currently working as Principal Architect at Emirates Group IT since 2005. Prior to this he has worked with Oracle Corporation and Ernst & Young. His main specialization is on various web technologies and acts as chief mentor and Architect to facilitate incorporating Spring as Corporate Standard in the organization.
Tomcy John

Latest posts by Tomcy John (see all)

2 thoughts on “Spring Book – Chapter 21 – Spring Batch

  1. Thanks for sharing the information but what’s the difference between CursorItemReader’s setFetchSize() and PagingItemReader’s setPageSize()? isn’t it the same?

  2. Please provide an example for StoredProcedureItem Reader – which returns cursor and how to process cursor in processor – I am new to Spring Batch as part of my work I need to invoke Oracle Stored proc which takes one param as input and returns result set which I need to process in Spring Batch Processor.


Leave a Reply

Your email address will not be published. Required fields are marked *