Package org.jeasy.batch.core.listener
Class CompositeBatchListener<P>
- java.lang.Object
-
- org.jeasy.batch.core.listener.CompositeBatchListener<P>
-
- Type Parameters:
P- type of the record's payload
- All Implemented Interfaces:
BatchListener<P>
public class CompositeBatchListener<P> extends java.lang.Object implements BatchListener<P>
Composite listener that delegates processing to other listeners.- Author:
- Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
-
-
Constructor Summary
Constructors Constructor Description CompositeBatchListener()Create a newCompositeBatchListener.CompositeBatchListener(java.util.List<BatchListener<P>> listeners)Create a newCompositeBatchListener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBatchListener(BatchListener<P> batchListener)Add a delegate listener.voidafterBatchProcessing(Batch<P> batch)Executed after processing each batch.voidafterBatchWriting(Batch<P> batch)Executed after successfully writing each batch.voidbeforeBatchReading()Executed before reading each batch.voidonBatchWritingException(Batch<P> batch, java.lang.Throwable throwable)Executed when an error occurs during writing each batch.
-
-
-
Constructor Detail
-
CompositeBatchListener
public CompositeBatchListener()
Create a newCompositeBatchListener.
-
CompositeBatchListener
public CompositeBatchListener(java.util.List<BatchListener<P>> listeners)
Create a newCompositeBatchListener.- Parameters:
listeners- delegates
-
-
Method Detail
-
beforeBatchReading
public void beforeBatchReading()
Description copied from interface:BatchListenerExecuted before reading each batch.- Specified by:
beforeBatchReadingin interfaceBatchListener<P>
-
afterBatchProcessing
public void afterBatchProcessing(Batch<P> batch)
Description copied from interface:BatchListenerExecuted after processing each batch.- Specified by:
afterBatchProcessingin interfaceBatchListener<P>- Parameters:
batch- the batch of records that has been processed
-
afterBatchWriting
public void afterBatchWriting(Batch<P> batch)
Description copied from interface:BatchListenerExecuted after successfully writing each batch.- Specified by:
afterBatchWritingin interfaceBatchListener<P>- Parameters:
batch- the batch of records that has been written
-
onBatchWritingException
public void onBatchWritingException(Batch<P> batch, java.lang.Throwable throwable)
Description copied from interface:BatchListenerExecuted when an error occurs during writing each batch.- Specified by:
onBatchWritingExceptionin interfaceBatchListener<P>- Parameters:
batch- the batch attempted to be writtenthrowable- the error occurred
-
addBatchListener
public void addBatchListener(BatchListener<P> batchListener)
Add a delegate listener.- Parameters:
batchListener- to add
-
-