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 (mahmoud.benhassine@icloud.com)
-
-
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 voidaddPipelineListener(PipelineListener pipelineListener)Add a delegate listener.<P> voidafterRecordProcessing(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> voidonRecordProcessingException(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:PipelineListenerCalled before the record gets processed. If you create a new record, you must keep the original header of the modified record.- Specified by:
beforeRecordProcessingin 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:PipelineListenerCalled after the record has been processed.- Specified by:
afterRecordProcessingin interfacePipelineListener- Parameters:
inputRecord- The record to process.outputRecord- The processed record. May benullif the record has been filtered
-
onRecordProcessingException
public <P> void onRecordProcessingException(Record<P> record, java.lang.Throwable throwable)
Description copied from interface:PipelineListenerCalled when an exception occurs during record processing- Specified by:
onRecordProcessingExceptionin 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
-
-