Class JsrFaultTolerantChunkProcessor<I,O>
- java.lang.Object
- org.springframework.batch.core.jsr.step.item.JsrChunkProcessor<I,O>
- org.springframework.batch.core.jsr.step.item.JsrFaultTolerantChunkProcessor<I,O>
- Type Parameters:
I
- input type for the stepO
- output type for the step
- All Implemented Interfaces:
ChunkProcessor<I>
public class JsrFaultTolerantChunkProcessor<I,O> extends JsrChunkProcessor<I,O>
Extension of theJsrChunkProcessor
that adds skip and retry functionality.- Author:
- Michael Minella, Chris Schaefer
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.logging.Log
logger
Constructor Summary
Constructors Constructor Description JsrFaultTolerantChunkProcessor(ItemReader<? extends I> reader, ItemProcessor<? super I,? extends O> processor, ItemWriter<? super O> writer, RepeatOperations repeatTemplate, BatchRetryTemplate batchRetryTemplate)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
persist(StepContribution contribution, Chunk<O> chunk)
Adds retry and skip logic to the write phase of the chunk loop.protected I
provide(StepContribution contribution, Chunk<I> chunk)
Adds retry and skip logic to the reading phase of the chunk loop.void
registerListener(StepListener listener)
Register a listener for callbacks at the appropriate stages in a process.void
setChunkMonitor(ChunkMonitor chunkMonitor)
void
setListeners(java.util.List<? extends StepListener> listeners)
Register someStepListener
s with the handler.void
setRollbackClassifier(org.springframework.classify.Classifier<java.lang.Throwable,java.lang.Boolean> rollbackClassifier)
void
setSkipPolicy(SkipPolicy skipPolicy)
protected O
transform(StepContribution contribution, I item)
Adds retry and skip logic to the process phase of the chunk loop.Methods inherited from class org.springframework.batch.core.jsr.step.item.JsrChunkProcessor
doPersist, doProvide, doTransform, getListener, process
Constructor Detail
JsrFaultTolerantChunkProcessor
public JsrFaultTolerantChunkProcessor(ItemReader<? extends I> reader, ItemProcessor<? super I,? extends O> processor, ItemWriter<? super O> writer, RepeatOperations repeatTemplate, BatchRetryTemplate batchRetryTemplate)
Method Detail
setSkipPolicy
public void setSkipPolicy(SkipPolicy skipPolicy)
- Parameters:
skipPolicy
- aSkipPolicy
setRollbackClassifier
public void setRollbackClassifier(org.springframework.classify.Classifier<java.lang.Throwable,java.lang.Boolean> rollbackClassifier)
- Parameters:
rollbackClassifier
- aClassifier
setChunkMonitor
public void setChunkMonitor(ChunkMonitor chunkMonitor)
- Parameters:
chunkMonitor
- aChunkMonitor
setListeners
public void setListeners(java.util.List<? extends StepListener> listeners)
Register someStepListener
s with the handler. Each will get the callbacks in the order specified at the correct stage.- Overrides:
setListeners
in classJsrChunkProcessor<I,O>
- Parameters:
listeners
- listeners to be registered
registerListener
public void registerListener(StepListener listener)
Register a listener for callbacks at the appropriate stages in a process.- Overrides:
registerListener
in classJsrChunkProcessor<I,O>
- Parameters:
listener
- aStepListener
provide
protected I provide(StepContribution contribution, Chunk<I> chunk) throws java.lang.Exception
Adds retry and skip logic to the reading phase of the chunk loop.- Overrides:
provide
in classJsrChunkProcessor<I,O>
- Parameters:
contribution
- aStepContribution
chunk
- aChunk
- Returns:
- I an item
- Throws:
java.lang.Exception
- thrown if error occurs.
transform
protected O transform(StepContribution contribution, I item) throws java.lang.Exception
Adds retry and skip logic to the process phase of the chunk loop.- Overrides:
transform
in classJsrChunkProcessor<I,O>
- Parameters:
contribution
- aStepContribution
item
- an item to be processed- Returns:
- O an item that has been processed if a processor is available
- Throws:
java.lang.Exception
- thrown if error occurs.
persist
protected void persist(StepContribution contribution, Chunk<O> chunk) throws java.lang.Exception
Adds retry and skip logic to the write phase of the chunk loop.- Overrides:
persist
in classJsrChunkProcessor<I,O>
- Parameters:
contribution
- aStepContribution
chunk
- aChunk
- Throws:
java.lang.Exception
- thrown if error occurs.