Package org.jeasy.batch.core.writer
Class CompositeRecordWriter<P>
- java.lang.Object
-
- org.jeasy.batch.core.writer.CompositeRecordWriter<P>
-
- Type Parameters:
P
- type of the record's payload
- All Implemented Interfaces:
RecordWriter<P>
public class CompositeRecordWriter<P> extends java.lang.Object implements RecordWriter<P>
Composite writer that delegates record writing to a list of writers.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Constructor Summary
Constructors Constructor Description CompositeRecordWriter(java.util.List<RecordWriter<P>> writers)
Create a newCompositeRecordWriter
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the writervoid
open()
Open the writer.void
writeRecords(Batch<P> batch)
Write a batch of records to a data sink.
-
-
-
Constructor Detail
-
CompositeRecordWriter
public CompositeRecordWriter(java.util.List<RecordWriter<P>> writers)
Create a newCompositeRecordWriter
.- Parameters:
writers
- delegates
-
-
Method Detail
-
open
public void open() throws java.lang.Exception
Description copied from interface:RecordWriter
Open the writer.- Specified by:
open
in interfaceRecordWriter<P>
- Throws:
java.lang.Exception
- if an error occurs during opening the writer
-
writeRecords
public void writeRecords(Batch<P> batch) throws java.lang.Exception
Description copied from interface:RecordWriter
Write a batch of records to a data sink.- Specified by:
writeRecords
in interfaceRecordWriter<P>
- Parameters:
batch
- of records to write.- Throws:
java.lang.Exception
- if an error occurs during record writing
-
close
public void close() throws java.lang.Exception
Description copied from interface:RecordWriter
Close the writer- Specified by:
close
in interfaceRecordWriter<P>
- Throws:
java.lang.Exception
- if an error occurs during closing the writer
-
-