Package org.jeasy.batch.core.writer
Class BlockingQueueRecordWriter<P>
- java.lang.Object
-
- org.jeasy.batch.core.writer.BlockingQueueRecordWriter<P>
-
- Type Parameters:
P- type of the record's payload
- All Implemented Interfaces:
RecordWriter<P>
public class BlockingQueueRecordWriter<P> extends java.lang.Object implements RecordWriter<P>
Write records to aBlockingQueue.- Author:
- Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_TIMEOUT
-
Constructor Summary
Constructors Constructor Description BlockingQueueRecordWriter(java.util.concurrent.BlockingQueue<Record<P>> blockingQueue)Create a newBlockingQueueRecordWriter.BlockingQueueRecordWriter(java.util.concurrent.BlockingQueue<Record<P>> blockingQueue, long timeout)Create a newBlockingQueueRecordWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidwriteRecords(Batch<P> batch)Write a batch of records to a data sink.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jeasy.batch.core.writer.RecordWriter
close, open
-
-
-
-
Field Detail
-
DEFAULT_TIMEOUT
public static final long DEFAULT_TIMEOUT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BlockingQueueRecordWriter
public BlockingQueueRecordWriter(java.util.concurrent.BlockingQueue<Record<P>> blockingQueue)
Create a newBlockingQueueRecordWriter.- Parameters:
blockingQueue- to write records to
-
BlockingQueueRecordWriter
public BlockingQueueRecordWriter(java.util.concurrent.BlockingQueue<Record<P>> blockingQueue, long timeout)
Create a newBlockingQueueRecordWriter.- Parameters:
blockingQueue- to write records totimeout- in milliseconds after which the writer will throw an exception
-
-
Method Detail
-
writeRecords
public void writeRecords(Batch<P> batch) throws java.lang.Exception
Description copied from interface:RecordWriterWrite a batch of records to a data sink.- Specified by:
writeRecordsin interfaceRecordWriter<P>- Parameters:
batch- of records to write.- Throws:
java.lang.Exception- if an error occurs during record writing
-
-