The test case is: commit-interval of 2, max-retries = 1, exception thrown every time the item a is written.
This is the behaviour we have seen:
Code:
Chunk: a, b
- process of a, b
- write of a, b => ignorable exception
- process of a
- write of a, b => ignorable exception
- process of a
- write of a => ignorable exception
- process of b
- write of b
We're expecting:
Code:
Chunk: a, b
- process of a, b
- write of a, b => exception
- process of a
- write of a => exception
- process of a
- write of a => exception
- process of b
- write of b
It seems that when it has tried one times to write a, b (max-retries = 1) according to the exception which is ignorable (the exception is skipped), it begins to process and write one-by-one. But, if the exception cannot be skipped (non-ignorable), it never processes and writes one-by-one and we get the follow result:
Code:
Chunk: a, b
- process of a, b
- write of a, b => ignorable exception
- process of a => can be retried + cannot be skipped
We are using templates, I hope the following code is adequate to understand the config file. The exception is thrown by the first partition of step1.partition (the second partition is executed successfully).
Code:
<job id="templateJob" parent="abstractGenericJob"
xmlns="http://www.springframework.org/schema/batch">
<step id="preProcessing" next="staging" parent="templateJob.internal.preProcessing"/>
<step id="staging" next="step1.partition" parent="templateJob.internal.staging"/>
<step id="step1.partition" next="step2.partition" parent="templateJob.internal.partition1"/>
<step id="step2.partition" parent="templateJob.internal.partition2">
<next on="COMPLETED" to="postProcessing"/>
<end on="COMPLETED WITH *"/>
</step>
<step id="postProcessing" parent="templateJob.internal.postProcessing"/>
</job>
<!-- Step 2 -->
<step id="templateJob.internal.partition2" parent="abstractPartitionerStagedStep"
xmlns="http://www.springframework.org/schema/batch">
<partition step="step2" partitioner="step2.partitioner">
<handler grid-size="${step2.grid.size}" task-executor="step2.taskExecutor"/>
</partition>
</step>
<step id="step2" parent="abstractStagedPartitionStep"
xmlns="http://www.springframework.org/schema/batch">
<!-- outside a partition must use abstractStagedStep -->
<tasklet>
<chunk reader="stagingItemReader" processor="step2.internal.itemProcessor"
writer="step2.internal.itemWriter" commit-interval="${step2.commit.interval}"/>
</tasklet>
</step>