Package org.jeasy.batch.core.listener
Class CompositePipelineListener
- java.lang.Object
-
- org.jeasy.batch.core.listener.CompositePipelineListener
-
- All Implemented Interfaces:
PipelineListener
public class CompositePipelineListener extends java.lang.Object implements PipelineListener
Composite listener that delegates processing to other listeners.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Constructor Summary
Constructors Constructor Description CompositePipelineListener()
Create a newCompositePipelineListener
.CompositePipelineListener(java.util.List<PipelineListener> listeners)
Create a newCompositePipelineListener
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPipelineListener(PipelineListener pipelineListener)
Add a delegate listener.<P> void
afterRecordProcessing(Record<P> inputRecord, Record<P> outputRecord)
Called after the record has been processed.<P> Record<P>
beforeRecordProcessing(Record<P> record)
Called before the record gets processed.<P> void
onRecordProcessingException(Record<P> record, java.lang.Throwable throwable)
Called when an exception occurs during record processing
-
-
-
Constructor Detail
-
CompositePipelineListener
public CompositePipelineListener()
Create a newCompositePipelineListener
.
-
CompositePipelineListener
public CompositePipelineListener(java.util.List<PipelineListener> listeners)
Create a newCompositePipelineListener
.- Parameters:
listeners
- delegates
-
-
Method Detail
-
beforeRecordProcessing
public <P> Record<P> beforeRecordProcessing(Record<P> record)
Description copied from interface:PipelineListener
Called before the record gets processed. If you create a new record, you must keep the original header of the modified record.- Specified by:
beforeRecordProcessing
in interfacePipelineListener
- Parameters:
record
- The record that will be processed.- Returns:
- the pre-processed record
-
afterRecordProcessing
public <P> void afterRecordProcessing(Record<P> inputRecord, Record<P> outputRecord)
Description copied from interface:PipelineListener
Called after the record has been processed.- Specified by:
afterRecordProcessing
in interfacePipelineListener
- Parameters:
inputRecord
- The record to process.outputRecord
- The processed record. May benull
if the record has been filtered
-
onRecordProcessingException
public <P> void onRecordProcessingException(Record<P> record, java.lang.Throwable throwable)
Description copied from interface:PipelineListener
Called when an exception occurs during record processing- Specified by:
onRecordProcessingException
in interfacePipelineListener
- Parameters:
record
- the record attempted to be processedthrowable
- the throwable that was thrown during record processing
-
addPipelineListener
public void addPipelineListener(PipelineListener pipelineListener)
Add a delegate listener.- Parameters:
pipelineListener
- to add
-
-