简体   繁体   中英

Notification on restart Spring-Batch

I was wondering if there is some tool that logs the restartability of a job. For instance, if I have a job that fails half way through due to an invalid input in a flat file, and re-run the job with the input removed, how can I signal that the job restarted from the same place it left off?

The functionality for restarting works. The job continues off from where it failed. I just want to have a log statement that says "Restarted from:"

That is an interesting question. I'm not aware, that there is a flag that directly indicates, that this is a restart.

What I would try to do is to check the SpringBatch-RuntimeTables. A restart shares has the same JobInstance-Entry but another JobExecution-Entry. Therefore, if the number of JobExecutions with your actuall JobInstanceId is greater than 1, you have restart.

(Check the content of "BATCH__JOB_EXECUTION" table and its columns JOB_EXECUTION_ID and JOB_INSTANCE_ID).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM