Description
Regarding the retry() and retryLimit() method that can be added to a faultTolerantStepBuilder.
Example:
@Bean
public Step step1(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
return new StepBuilder("step1", jobRepository)
.<String, String>chunk(2, transactionManager)
.reader(itemReader())
.writer(itemWriter())
.faultTolerant()
.retryLimit(3)
.retry(Exception.class)
.build();
}
The official documentation here specifies that
The Step allows a limit for the number of times an individual item can be retried
First, the retry limit is not actually the number of retries but rather the maximum number of failed tries, since a limit of 1 one will yield no retries.
Second, in the example above, imagine the following scenario (notice the chunk size is 2 and the retry limit is 3):
An error is thrown on the two first tries for item A.
On the third attempt, item A is written succesfully.
Then, an error is thrown for item B.
Observed result: The step fails immediately for having reached the retry limit of 3.
Is the documentation misleading or there is something I am missing here ?