Prashant Shilimkar
Prashant Shilimkar

Reputation: 8820

How to restart failed Chunks - Spring batch

I am writing Spring batch for chunk processing. I have Single Job and Single Step. Within that Step I have Chunks which are dynamically sized.

SingleJob -> SingleStep -> chunk_1..chunk_2..chunk_3...so on

Following is a case I am trying to implement,

If Today I ran a Job and only chunk_2 failed and rest of chunks ran successfully. Now Tomorrow I want to run/restart ONLY failed chunks i.e. in this case chunk_2. (I don't want to run whole Job/Step/Other successfully completed Chunks)

I see Spring batch allow to store metadata and using that it helps to restart Jobs. but I did not get if it is possible to restart specific chunk as discuss above.

Am I missing any concept or if it is possible then any pseudo code/theoretical explanation or reference will help.

I appreciate your response

Upvotes: 1

Views: 1683

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31590

That's how Spring Batch works in a restart scenario, it will continue where it left off in the previous failed run.

So in your example, if the in the first run chunk1 has been correctly processed and chunk2 failed, the next job execution will restart at chunk2.

Upvotes: 1

Related Questions