Gracefully shutdown the spring batch process and recover batch process incase failed
We are using Spring Batch for some back-end operations. We need to know authentic way of 1) How to gracefully shutdown a running spring batch process? 2) How to be sure that a particular spring batch process is crashed and recover/launch it on ot开发者_StackOverflowher machine
1) Spring batch did provide a cancel job api (I cannot recall exactly where it is... in JobLauncher?) Invoking it will cause the existing running step to stop (e.g. iteration will stop for built-in item-oriented steps, or you can check on some state in your tasklet).
2) If it is a "crash", which means spring batch is unable to perform updates to its metadata (job execution, step execution etc) correctly, as far as I know, you are responsible to manually verify if the status of the step, and update the exit status and status of the step to a correct (and recoverable) value.
精彩评论