Spring Batch and Quartz have different goals.
Spring Batch provides functionality for processing large volumes of data and Quartz provides functionality for scheduling tasks.
So Quartz could complement Spring Batch, but are not excluding technologies.
A common combination would be to use Quartz as a trigger for a Spring Batch job using a Cron expression and the Spring Core convenience SchedulerFactoryBean.
A Job has one to many steps, each of which has exactly one ItemReader
, one ItemProcessor
, and one ItemWriter
.
A job needs to be launched (with JobLauncher
), and metadata about the currently running process needs to be stored (in JobRepository
).
A Job is an entity that encapsulates an entire batch process.
Spring Batch at the fundamental is a State Machine.
A Job defines the list of states and how to transition from one state to the next.
A Step represents an independent piece of processing that makes up a job. A Job may have many Steps.
A Step is a domain object that encapsulates an independent, sequential phase of a batch job. Therefore, every Job is composed entirely of one or more steps. A Step contains all the information necessary to define and control the actual batch processing.
A StepExecution
represents a single attempt to execute a Step
.
A new StepExecution
is created each time a Step
is run, similar to JobExecution
. However, if a step fails to execute because the step before it fails, no execution is persisted for it.
A StepExecution
is created only when its Step
is actually started.
Step executions are represented by objects of the StepExecution
class.
Each execution contains a reference to its corresponding step and JobExecution
and transaction related data, such as commit and rollback counts and start and end times.
Additionally, each step execution contains an ExecutionContext
, which contains any data a developer needs to have persisted across batch runs, such as statistics or state information needed to restart.
Steps are executed sequentially.
ItemProcessor
is optional.
⭐ Star this repository — it helps!