Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
RetryTemplate causes rollback exceptions to fail whole chunk [BATCH-2298] #1305
When an exception occurs in a chunk, the retry template will maintain the last exception thrown.
Given a recurrent exception, like a validation exception in a processor, Spring Batch will handle each record in the chunk as a skip and reuse the first exception as the throwable. I believe this is because of the Retry Template's reuse of the lastException variable.
It is hard for me to say if this applies to 3.x versions of Spring Batch. It looks like Spring Retry was separated into it's own project but I'm not sure if this behavior still exists in Spring Batch after 2.x versions.
I'm not sure if 2.x is still maintained but if so, I can provide more details and have ideas on a potential resolution. For example, a configurable ChunkException which wraps the lastException instead of rethrowing it. That would at least make the error apparent to the developer and creates awareness by documenting the feature.
No, Spring Batch v2 and v3 are not maintained anymore.
It is hard to say from what you shared if this applies to v4.2. Please provide a minimal example that reproduces the problem and we can re-open this issue if necessary.