Intercepting a Spring Batch job with listeners
Spring Batch comes with listeners. They intercept the job execution to perform certain tasks. StepListener
is a super
class for the following mentioned listeners:
SkipListener
: One of the most common use cases forSkipListener
is to log out a skipped item so that another batch process, or even human process, can be used to evaluate and fix the issue leading to the skip. Because there are many cases in which the original transaction may be rolled back, Spring Batch makes two guarantees:- The appropriate
skip
method (depending on when the error happened) will only be called once per item. - The
SkipListener
will always be called just before the transaction is committed. This is to ensure that any transactional ...
- The appropriate
Get Mastering Spring Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.