Package org.jeasy.batch.core.listener
Class CompositeRecordWriterListener<P>
- java.lang.Object
-
- org.jeasy.batch.core.listener.CompositeRecordWriterListener<P>
-
- Type Parameters:
P- type of the record's payload
- All Implemented Interfaces:
RecordWriterListener<P>
public class CompositeRecordWriterListener<P> extends java.lang.Object implements RecordWriterListener<P>
Composite listener that delegates processing to other listeners.- Author:
- Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
-
-
Constructor Summary
Constructors Constructor Description CompositeRecordWriterListener()Create a newCompositeRecordWriterListener.CompositeRecordWriterListener(java.util.List<RecordWriterListener<P>> listeners)Create a newCompositeRecordWriterListener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRecordWriterListener(RecordWriterListener<P> recordWriterListener)Add a delegate listener.voidafterRecordWriting(Batch<P> batch)Called after writing each batch of records.voidbeforeRecordWriting(Batch<P> batch)Called before writing each batch of records.voidonRecordWritingException(Batch<P> batch, java.lang.Throwable throwable)Called when an exception occurs during batch writing.
-
-
-
Constructor Detail
-
CompositeRecordWriterListener
public CompositeRecordWriterListener()
Create a newCompositeRecordWriterListener.
-
CompositeRecordWriterListener
public CompositeRecordWriterListener(java.util.List<RecordWriterListener<P>> listeners)
Create a newCompositeRecordWriterListener.- Parameters:
listeners- delegates
-
-
Method Detail
-
beforeRecordWriting
public void beforeRecordWriting(Batch<P> batch)
Description copied from interface:RecordWriterListenerCalled before writing each batch of records.- Specified by:
beforeRecordWritingin interfaceRecordWriterListener<P>- Parameters:
batch- to be written
-
afterRecordWriting
public void afterRecordWriting(Batch<P> batch)
Description copied from interface:RecordWriterListenerCalled after writing each batch of records.- Specified by:
afterRecordWritingin interfaceRecordWriterListener<P>- Parameters:
batch- of records that have been written.
-
onRecordWritingException
public void onRecordWritingException(Batch<P> batch, java.lang.Throwable throwable)
Description copied from interface:RecordWriterListenerCalled when an exception occurs during batch writing.- Specified by:
onRecordWritingExceptionin interfaceRecordWriterListener<P>- Parameters:
batch- attempted to be writtenthrowable- the throwable that was thrown during record writing
-
addRecordWriterListener
public void addRecordWriterListener(RecordWriterListener<P> recordWriterListener)
Add a delegate listener.- Parameters:
recordWriterListener- to add
-
-