Bored
Bored

Reputation: 499

Spring Batch JobOperator.restart start a new job instance and don't resume job from the last chunk but just from last step

  jobOperator.restart(JobExecutionId) 

starts a new job instance and don't resume job from the last chunk but just from last step. I need to resume the job from the last chunk written.

My reader is a custom RestReader that count first the total of items to process and then read this exact number from api. I'm using @StepScope annotation because I need custom variables in custom reader

Spring Batch restart functionality not working when using @StepScope.

Is it possible to resume the job from last chunk written or the problem is my custom reader?

Upvotes: 0

Views: 883

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31600

Your RestReader must implement ItemStream. This is the contract that stateful item readers should implement. The ItemStream#update method will be called at chunk boundaries to save any contextual data required to restart from the last checkpoint in case of failure.

Upvotes: 0

Related Questions