2. What is Spring Batch?
Spring Batch provides reusable functions that are essential in processing large
volumes of records, including logging/tracing, transaction management, job
processing statistics, job restart, skip, and resource management. It also
provides more advanced technical services and features that will enable
extremely high-volume and high performance batch jobs through optimization
and partitioning techniques. Simple as well as complex, high-volume batch jobs
can leverage the framework in a highly scalable manner to process significant
volumes of information.
3. Features
● Transaction management
● Chunk based processing
● Declarative I/O
● Start/Stop/Restart
● Retry/Skip
● Web based administration interface (Spring Batch Admin)
5. A batch job is a computer program or set of programs processed in batch mode.
This means that a sequence of commands to be executed by the operating
system is listed in a file (often called a batch file, command file, or shell script)
and submitted for execution as a single unit.
A batch job reads input data, processes the input data, and writes the processed
data to the configured output.
8. A Spring Batch job consists of the
following components
● The Job represents the Spring Batch job. Each job can have one or more steps.
● The Step represents an independent logical task (i.e. import information from an input file). Each step
belongs to one job.
● The ItemReader reads the input data and provides the found items one by one. An ItemReader belongs to
one step and each step must have only one ItemReader.
● The ItemProcessor transforms items into a form that is understood by the ItemWriter one item at a time. An
ItemProcessor belongs to one step and each step can have one ItemProcessor.
9. Job Repositories
Job repositories are abstractions responsible of the storing and updating of metadata information related to Job
instance executions and Job contexts.
Spring stores as metadata information about their executions, the results obtained, their instances, the parameters
used for the Jobs executed and the context where the processing runs. The table names are very intuitive and similar
to their domain classes counterparts, in this link there is an image with a very good summary of these tables.
10. Item Readers
● AmqpItemReader
● AggregateItemReader
● FlatFileItemReader
● HibernateCursorItemReader
● HibernatePagingItemReader
● IbatisPagingItemReader
● ItemReaderAdapter
● ListItemReader
● MongoItemReader
● Neo4jItemReader
● RepositoryItemReader
● StoredProcedureItemReader
● StaxEventItemReader
Writers are abstractions responsible of writing the data to the desired output database or system.
11. Item Writers
● AbstractItemStreamItemWriter
● AmqpItemWriter
● CompositeItemWriter
● FlatFileItemWriter
● GemfireItemWriter
● JdbcBatchItemWriter
● JmsItemWriter
● JpaItemWriter
● MimeMessageItemWriter
● MongoItemWriter
Writers are abstractions responsible of writing the data to the desired output database or system.
12. Item Processors
Processors are in charge of modifying the data records converting it from the input format to the output desired one.
13. Use Cases
● Conversion Applications
● Filtering or validation applications
● Database extractors
● Reporting