|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.core.step.item.SimpleChunkProcessor<I,O>
org.springframework.batch.core.step.item.FaultTolerantChunkProcessor<I,O>
public class FaultTolerantChunkProcessor<I,O>
FaultTolerant implementation of the ChunkProcessor interface, that
allows for skipping or retry of items that cause exceptions during writing.
| Constructor Summary | |
|---|---|
FaultTolerantChunkProcessor(org.springframework.batch.item.ItemProcessor<? super I,? extends O> itemProcessor,
org.springframework.batch.item.ItemWriter<? super O> itemWriter,
BatchRetryTemplate batchRetryTemplate)
|
|
| Method Summary | |
|---|---|
protected Chunk<O> |
getAdjustedOutputs(Chunk<I> inputs,
Chunk<O> outputs)
Extension point for subclasses that want to adjust the outputs based on additional saved data in the inputs. |
protected int |
getFilterCount(Chunk<I> inputs,
Chunk<O> outputs)
Extension point for subclasses to calculate the filter count. |
protected void |
initializeUserData(Chunk<I> inputs)
Extension point for subclasses to allow them to memorise the contents of the inputs, in case they are needed for accounting purposes later. |
protected boolean |
isComplete(Chunk<I> inputs)
Extension point for subclasses that want to store additional data in the inputs. |
void |
setBuffering(boolean buffering)
A flag to indicate that items have been buffered and therefore will always come back as a chunk after a rollback. |
void |
setChunkMonitor(org.springframework.batch.core.step.item.ChunkMonitor chunkMonitor)
|
void |
setKeyGenerator(KeyGenerator keyGenerator)
The KeyGenerator to use to identify failed items across rollback. |
void |
setProcessSkipPolicy(SkipPolicy SkipPolicy)
|
void |
setRollbackClassifier(org.springframework.batch.classify.Classifier<java.lang.Throwable,java.lang.Boolean> rollbackClassifier)
A classifier that can distinguish between exceptions that cause rollback (return true) or not (return false). |
void |
setWriteSkipPolicy(SkipPolicy SkipPolicy)
|
protected Chunk<O> |
transform(StepContribution contribution,
Chunk<I> inputs)
|
protected void |
write(StepContribution contribution,
Chunk<I> inputs,
Chunk<O> outputs)
Simple implementation delegates to the SimpleChunkProcessor.doWrite(List) method and
increments the write count in the contribution. |
| Methods inherited from class org.springframework.batch.core.step.item.SimpleChunkProcessor |
|---|
afterPropertiesSet, doAfterWrite, doProcess, doWrite, getListener, process, registerListener, setItemProcessor, setItemWriter, setListeners, writeItems |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FaultTolerantChunkProcessor(org.springframework.batch.item.ItemProcessor<? super I,? extends O> itemProcessor,
org.springframework.batch.item.ItemWriter<? super O> itemWriter,
BatchRetryTemplate batchRetryTemplate)
| Method Detail |
|---|
public void setKeyGenerator(KeyGenerator keyGenerator)
KeyGenerator to use to identify failed items across rollback.
Not used in the case of the buffering flag
being true (the default).
keyGenerator - the KeyGenerator to setpublic void setProcessSkipPolicy(SkipPolicy SkipPolicy)
SkipPolicy - the SkipPolicy for item processingpublic void setWriteSkipPolicy(SkipPolicy SkipPolicy)
SkipPolicy - the SkipPolicy for item writingpublic void setRollbackClassifier(org.springframework.batch.classify.Classifier<java.lang.Throwable,java.lang.Boolean> rollbackClassifier)
rollbackClassifier - public void setChunkMonitor(org.springframework.batch.core.step.item.ChunkMonitor chunkMonitor)
chunkMonitor - public void setBuffering(boolean buffering)
buffering - protected void initializeUserData(Chunk<I> inputs)
SimpleChunkProcessorSimpleChunkProcessor.isComplete(Chunk), SimpleChunkProcessor.getFilterCount(Chunk, Chunk) and
SimpleChunkProcessor.getAdjustedOutputs(Chunk, Chunk) might also need to be, to
ensure that the user data is handled consistently.
initializeUserData in class SimpleChunkProcessor<I,O>inputs - the inputs for the process
protected int getFilterCount(Chunk<I> inputs,
Chunk<O> outputs)
SimpleChunkProcessor
getFilterCount in class SimpleChunkProcessor<I,O>inputs - the inputs after transformationoutputs - the outputs after transformation
SimpleChunkProcessor.initializeUserData(Chunk)protected boolean isComplete(Chunk<I> inputs)
SimpleChunkProcessor
isComplete in class SimpleChunkProcessor<I,O>inputs - the input chunk
SimpleChunkProcessor.initializeUserData(Chunk)
protected Chunk<O> getAdjustedOutputs(Chunk<I> inputs,
Chunk<O> outputs)
SimpleChunkProcessor
getAdjustedOutputs in class SimpleChunkProcessor<I,O>inputs - the inputs for the transformationoutputs - the result of the transformation
SimpleChunkProcessor.initializeUserData(Chunk)
protected Chunk<O> transform(StepContribution contribution,
Chunk<I> inputs)
throws java.lang.Exception
transform in class SimpleChunkProcessor<I,O>java.lang.Exception
protected void write(StepContribution contribution,
Chunk<I> inputs,
Chunk<O> outputs)
throws java.lang.Exception
SimpleChunkProcessorSimpleChunkProcessor.doWrite(List) method and
increments the write count in the contribution. Subclasses can handle
more complicated scenarios, e.g.with fault tolerance. If output items are
skipped they should be removed from the inputs as well.
write in class SimpleChunkProcessor<I,O>contribution - the current step contributioninputs - the inputs that gave rise to the ouputsoutputs - the outputs to write
java.lang.Exception - if there is a problem
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||