Spring Batch - Reference Documentation


Lucas Ward, Dave Syer, Thomas Risberg, Robert Kasanicky, Dan Garrette, Wayne Lund

Spring Batch 2.0.3.RELEASE

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.

1. Spring Batch Introduction
1.1. Background
1.2. Usage Scenarios
1.3. Spring Batch Architecture
2. What's New in Spring Batch 2.0
2.1. Java 5
2.2. Chunk Oriented Processing
2.2.1. ItemProcessor
2.3. Configuration Enhancements
2.4. Meta Data Access Improvements
2.5. Non Sequential Step Execution
2.6. Scalability
2.6.1. Remote Chunking
2.6.2. Partitioning
3. The Domain Language of Batch
3.1. Job
3.1.1. JobInstance
3.1.2. JobParameters
3.1.3. JobExecution
3.2. Step
3.2.1. StepExecution
3.3. ExecutionContext
3.4. JobRepository
3.5. JobLauncher
3.6. Item Reader
3.7. Item Writer
3.8. Item Processor
3.9. Batch Namespace
4. Configuring and Running a Job
4.1. Configuring a Job
4.1.1. Restartability
4.1.2. Intercepting Job Execution
4.1.3. Inheriting from a Parent Job
4.1.4. JobFactory and Stateful Components in Steps
4.2. Configuring a JobRepository
4.2.1. Transaction Configuration for the JobRepository
4.2.2. Changing the Table Prefix
4.2.3. In-Memory Repository
4.2.4. Non-standard Database Types in a Repository
4.3. Configuring a JobLauncher
4.4. Running a Job
4.4.1. Running Jobs from the Command Line The CommandLineJobRunner ExitCodes
4.4.2. Running Jobs from within a Web Container
4.5. Advanced Meta-Data Usage
4.5.1. Querying the Repository
4.5.2. JobOperator
4.5.3. JobParametersIncrementer
4.5.4. Stopping a Job
5. Configuring a Step
5.1. Chunk-Oriented Processing
5.1.1. Configuring a Step
5.1.2. Referencing a Standalone Step
5.1.3. Inheriting from a Parent Step Abstract Step Merging Lists
5.1.4. The Commit Interval
5.1.5. Configuring a Step for Restart Setting a StartLimit Restarting a completed step Step Restart Configuration Example
5.1.6. Configuring Skip Logic
5.1.7. Configuring Fatal Exceptions
5.1.8. Configuring Retry Logic
5.1.9. Controlling Rollback Transactional Readers
5.1.10. Transaction Attributes
5.1.11. Registering ItemStreams with the Step
5.1.12. Intercepting Step Execution StepExecutionListener ChunkListener ItemReadListener ItemProcessListener ItemWriteListener SkipListener
5.2. TaskletStep
5.2.1. TaskletAdapter
5.2.2. Example Tasklet Implementation
5.3. Controlling Step Flow
5.3.1. Sequential Flow
5.3.2. Conditional Flow Batch Status vs. Exit Status
5.3.3. Configuring for Stop The 'End' Element The 'Fail' Element The 'Stop' Element
5.3.4. Programmatic Flow Decisions
5.3.5. Split Flows
5.4. Late Binding of Job and Step Attributes
5.4.1. Step Scope
6. ItemReaders and ItemWriters
6.1. ItemReader
6.2. ItemWriter
6.3. ItemProcessor
6.3.1. Chaining ItemProcessors
6.3.2. Filtering Records
6.4. ItemStream
6.5. The Delegate Pattern and Registering with the Step
6.6. Flat Files
6.6.1. The FieldSet
6.6.2. FlatFileItemReader LineMapper LineTokenizer FieldSetMapper DefaultLineMapper Simple Delimited File Reading Example Mapping Fields by Name Automapping FieldSets to Domain Objects Fixed Length File Formats Multiple Record Types within a Single File Exception Handling in Flat Files
6.6.3. FlatFileItemWriter LineAggregator Simplified File Writing Example FieldExtractor Delimited File Writing Example Fixed Width File Writing Example Handling File Creation
6.7. XML Item Readers and Writers
6.7.1. StaxEventItemReader
6.7.2. StaxEventItemWriter
6.8. Multi-File Input
6.9. Database
6.9.1. Cursor Based ItemReaders JdbcCursorItemReader HibernateCursorItemReader
6.9.2. Paging ItemReaders JdbcPagingItemReader JpaPagingItemReader IbatisPagingItemReader
6.9.3. Database ItemWriters
6.10. Reusing Existing Services
6.11. Validating Input
6.12. Preventing State Persistence
6.13. Creating Custom ItemReaders and ItemWriters
6.13.1. Custom ItemReader Example Making the ItemReader Restartable
6.13.2. Custom ItemWriter Example Making the ItemWriter Restartable
7. Scaling and Parallel Processing
7.1. Multi-threaded Step
7.2. Parallel Steps
7.3. Remote Chunking
7.4. Partitioning
7.4.1. PartitionHandler
7.4.2. StepExecutionSplitter
7.4.3. Binding Input Data to Steps
8. Repeat
8.1. RepeatTemplate
8.1.1. RepeatContext
8.1.2. RepeatStatus
8.2. Completion Policies
8.3. Exception Handling
8.4. Listeners
8.5. Parallel Processing
8.6. Declarative Iteration
9. Retry
9.1. RetryTemplate
9.1.1. RetryContext
9.1.2. RecoveryCallback
9.1.3. Stateless Retry
9.1.4. Stateful Retry
9.2. Retry Policies
9.3. Backoff Policies
9.4. Listeners
9.5. Declarative Retry
10. Unit Testing
10.1. Creating a Unit Test Class
10.2. End-To-End Testing of Batch Jobs
10.3. Testing Individual Steps
10.4. Validating Output Files
10.5. Mocking Domain Objects
11. Common Batch Patterns
11.1. Logging Item Processing and Failures
11.2. Stopping a Job Manually for Business Reasons
11.3. Adding a Footer Record
11.3.1. Writing a Summary Footer
11.4. Driving Query Based ItemReaders
11.5. Multi-Line Records
11.6. Executing System Commands
11.7. Handling Step Completion When No Input is Found
11.8. Passing Data to Future Steps
A. List of ItemReaders and ItemWriters
A.1. Item Readers
A.2. Item Writers
B. Meta-Data Schema
B.1. Overview
B.1.1. Example DDL Scripts
B.1.2. Version
B.1.3. Identity
B.8. Archiving
B.9. Recommendations for Indexing Meta Data Tables