Processor missed call in a retry
We are facing a behaviour that we cannot understand. In the code bellow, that's the parent step our test step. We've created 3 kinds of exceptions:
- Fatal Exceptions: if a reader, processor, writer throws that exceptions, the batch is immediately in failure
- Ignorable Exceptions: the batch can retry to re-process, or re-write, the skip policy returns true for that kind of exceptions
- Non ignorable exception: the batch can retry, but the skip policy doesn't skip these exceptions.
The "timeoutRetryPolicy" and "attemptsCounterRetryPolicy" are provided by Spring Batch (org.springframework.batch.retry.policy.TimeoutRet ryPolicy and org.springframework.batch.retry.policy.SimpleRetry Policy) while "exceptionsFilterRetryPolicy" is our own retry policy. It's used to returns false to fatal exceptions, otherwise true. The default skip policy skips ignorable exceptions and doesn't skip non ignorable exceptions.
<bean id="abstractGenericStep" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean" abstract="true">
<property name="transactionManager" ref="transactionManager" />
<property name="jobRepository" ref="jobRepository" />
<property name="backOffPolicy" ref="timeIntervalPolicy" />
<bean id="defaultRetryPolicy" class="org.springframework.batch.retry.policy.CompositeRetryPolicy">
<ref bean="timeoutRetryPolicy" />
<ref bean="attemptsCounterRetryPolicy" />
<bean id="exceptionsFilterRetryPolicy" class="com.bsb.sf.batch.service.exception.ExceptionsFilterRetryPolicy">
<property name="batchExceptionManager" ref="batchExceptionManager" />
<property name="skipPolicy" ref="defaultSkipPolicy" />
<property name="allowStartIfComplete" value="false" />
We have a commit-interval of 5. The first five items are written correctly. We throw an exception when the batch writes the 6th and 7th items. That exception is a fatal exception. So, the batch must stop, unfortunately, the processor is called to process the 6th. A RetryExhaustedException is thrown after its process and the batch is stopped.
Is our configuration correct ?