public class FaultTolerantChunkProvider<I> extends SimpleChunkProvider<I>
ChunkProcessor
interface, that
allows for skipping or retry of items that cause exceptions during reading or
processing.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_SKIPS_ON_READ
Hard limit for number of read skips in the same chunk.
|
itemReader, logger
Constructor and Description |
---|
FaultTolerantChunkProvider(ItemReader<? extends I> itemReader,
RepeatOperations repeatOperations) |
Modifier and Type | Method and Description |
---|---|
void |
postProcess(StepContribution contribution,
Chunk<I> chunk) |
protected I |
read(StepContribution contribution,
Chunk<I> chunk)
Delegates to
SimpleChunkProvider.doRead() . |
void |
setMaxSkipsOnRead(int maxSkipsOnRead) |
void |
setRollbackClassifier(org.springframework.classify.Classifier<java.lang.Throwable,java.lang.Boolean> rollbackClassifier)
Classifier to determine whether exceptions have been marked as
no-rollback (as opposed to skippable).
|
void |
setSkipPolicy(SkipPolicy SkipPolicy)
The policy that determines whether exceptions can be skipped on read.
|
doRead, getListener, provide, registerListener, setListeners
public static final int DEFAULT_MAX_SKIPS_ON_READ
public FaultTolerantChunkProvider(ItemReader<? extends I> itemReader, RepeatOperations repeatOperations)
public void setMaxSkipsOnRead(int maxSkipsOnRead)
maxSkipsOnRead
- the maximum number of skips on readpublic void setSkipPolicy(SkipPolicy SkipPolicy)
SkipPolicy
- public void setRollbackClassifier(org.springframework.classify.Classifier<java.lang.Throwable,java.lang.Boolean> rollbackClassifier)
rollbackClassifier
- the rollback classifier to setprotected I read(StepContribution contribution, Chunk<I> chunk) throws java.lang.Exception
SimpleChunkProvider
SimpleChunkProvider.doRead()
. Subclasses can add additional behaviour
(e.g. exception handling).read
in class SimpleChunkProvider<I>
contribution
- the current step execution contributionchunk
- the current chunkSkipOverflowException
- if specifically the chunk is accumulating
too much data (e.g. skips) and it wants to force a commit.java.lang.Exception
- if there is a generic issuepublic void postProcess(StepContribution contribution, Chunk<I> chunk)
postProcess
in interface ChunkProvider<I>
postProcess
in class SimpleChunkProvider<I>