Skip to content

Documentation says retry limit is item-based, but it behaves as if the limit is chunk-based. #4321

Open
@fxpaquette

Description

@fxpaquette

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: feedback-providedIssues for which the feedback requested from the reporter was provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions