SyntaxHighlighter

Tuesday, June 19, 2012

Spring Batch Pause (Part 1)

Spring Batch Pause - Not Implemented (yet!) 2.1.8

the documentation for Spring Batch 2.1.8 makes a couple of references to the 'pause' state.  However, pause is not implemented yet.  the use case is a bit of departure from the existing Spring Batch structure in that instead of creating a new Job Execution for the Job Instance, it needs to resume the existing Job Execution.  This requires a new or additional Job Launcher and some logic to 'fast forward' through the steps.

The solution I've put together so far uses the following;
- LTW to wrap the existing shouldStart private method allowing the logic to 'fast forward' through the steps --> defaults to 'false' if the step execution has already completed
- simple 'around' aspect to monitor 'pausing' of a step/job and 'stop' a job if it hits a 'paused' step
- independent persistence of step/job execution pausing implemented in the batch tables

more soon as the solution develops

No comments:

Post a Comment