-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation says retry limit is item-based, but it behaves as if the limit is chunk-based. #4321
Comments
Thank you for opening this issue. We do not exclude that this could be a bug in Spring Batch. However, we are not sure to reproduce your specific problem by piecing things together from code snippets. If you would like us to spend some time investigating, please spend some time providing a complete yet minimal example that reproduces the problem. To help you in reporting your issue, we have prepared a project template that you can use as a starting point. Please check the Issue Reporting Guidelines for more details about this. You can also check the chunk-scanning sample here (you might need to adapt it to retry items). Thank you for your collaboration. |
Hi, sorry for the late response. I've included a minimal example to reproduce the observed behavior. What I am trying to highlight is the fact that the retry limit (3 in my example) is actually chunk-based, rather than item-based as the docs says here Also, a retry limit of n yields only n-1 retries. Here is the output of my spring-batch-mcve.zip example:
|
Regarding the retry() and retryLimit() method that can be added to a faultTolerantStepBuilder.
Example:
The official documentation here specifies that
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 ?
The text was updated successfully, but these errors were encountered: