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 ([email protected])
-
-
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 void
addBatchListener(BatchListener<P> batchListener)
Add a delegate listener.void
afterBatchProcessing(Batch<P> batch)
Executed after processing each batch.void
afterBatchWriting(Batch<P> batch)
Executed after successfully writing each batch.void
beforeBatchReading()
Executed before reading each batch.void
onBatchWritingException(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:BatchListener
Executed before reading each batch.- Specified by:
beforeBatchReading
in interfaceBatchListener<P>
-
afterBatchProcessing
public void afterBatchProcessing(Batch<P> batch)
Description copied from interface:BatchListener
Executed after processing each batch.- Specified by:
afterBatchProcessing
in interfaceBatchListener<P>
- Parameters:
batch
- the batch of records that has been processed
-
afterBatchWriting
public void afterBatchWriting(Batch<P> batch)
Description copied from interface:BatchListener
Executed after successfully writing each batch.- Specified by:
afterBatchWriting
in 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:BatchListener
Executed when an error occurs during writing each batch.- Specified by:
onBatchWritingException
in 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
-
-