C H A P T E R 4
Understanding Jobs and Steps
In Chapter 2, you created your first job. You walked through the configuration of a job and steps,
executed the job, and configured a database to store your job repository. In that “Hello, World!”
example, you began to scratch the surface of what jobs and steps are in Spring Batch. This chapter
continues to explore jobs and steps at a much deeper level. You begin by learning what a job and a step
are in relation to the Spring Batch framework.
From there, you dive into great detail about what happens when jobs or steps are executed, from
loading them and validating that they're valid to running all the way through their completion. Then,
you dig into some code, see the various parts of jobs and steps that you can configure, and learn best
practices along the way. Finally, you see how different pieces of the batch puzzle can pass data to each
other via the various scopes involved in a Spring Batch process.
Although you dive deep into steps in this chapter, the largest parts of a step are their readers and
writers, which aren't covered here. Chapters 7 and 9 explore the input and output functionality available
in Spring Batch. This chapter keeps the I/O aspects of each step as simple as possible so you can focus
on the intricacies of steps in a job.
Introducing a Job
With the proliferation of web applications, you may have become used to the idea of an application
being broken up into requests and responses. Each request contains the data for a single unique piece of
processing that occurs. The result of the request is typically a view of some kind being returned to the
user. A web application can be made up of dozens to literally hundreds of unique interactions like this,
each structured the same way, as shown in Figure 4-1.
Figure 4-1. Request/Response processing of a web application