Java Reference
In-Depth Information
run this job with an input file that has customers that are not in the database, Spring Batch will keep
track (as always) of the items read and written as well as the items filtered by your ItemProcessor.
Looking at the results of your job via Spring Batch Admin in Figure 8-3, you can see just that.
Details for Step Execution
Figure 8-3. Results from a job that filtered three items
In Chapter 4, you learned about skipping items, which used exceptions to identify records that were
not to be processed. The difference between these two approaches is that this approach is intended for
records that are technically valid records. Your customer had no records that the customerFileReader
could not parse into an object. Instead, your business rules prevented you from being able to process
this record so you decided to filter it out of the steps results.
Although a simple concept, ItemProcessors are a piece of the Spring Batch framework that any
batch developer will spend large amounts of time in. This is where the business logic lives and is applied
to the items being processed.
Summary
ItemProcessors are where business logic can be applied to the items being processed in your jobs.
Spring Batch, instead of trying to help you, does what it should do for this piece of the framework: it gets
out of your way and lets you determine how to apply the logic of your business as needed. In the next
chapter, you will finish your look at the core components of Spring Batch by taking a deep dive into
ItemWriters.
 
Search WWH ::




Custom Search