I configure a step in XML like this:
<batch:step id="slaveStep">
<batch:tasklet>
<batch:chunk
reader="reader"
processor="processor"
writer="writer"
commit-interval="10"
skip-limit="100000">
<batch:skippable-exception-classes>
<batch:include class="MyException"/>
</batch:skippable-exception-classes>
</batch:chunk>
</batch:tasklet>
</batch:step>
In the java configuration I use a StepBuilder like this:
@Bean
public StepBuilder stepBuilder(String stepName)
{
return new StepBuilder(stepName);
}
@Bean
Step slaveStep()
{
return stepBuilder("slaveStep")
.<Movie, Movie>chunk(10)
.reader(reader(new HashMap<>()))
.processor(processor())
.writer(writer())
.build();
}
But I could not find a way to configure the skippable exception classes
You need to build up a FaultTolerantStepBuilder
using StepBuilder.faultTolerant
method.
return stepBuilder()
.chunk()
.faultTolerant()
.skip(MyException.class)
.skipLimit(100000)
.build()