Package org.jeasy.batch.core.writer
Class RetryableRecordWriter<P>
- java.lang.Object
-
- org.jeasy.batch.core.writer.RetryableRecordWriter<P>
-
- Type Parameters:
P- type of the record's payload
- All Implemented Interfaces:
RecordWriter<P>
public class RetryableRecordWriter<P> extends java.lang.Object implements RecordWriter<P>
Decorator that makes aRecordWriterretryable whenever the data sink is temporarily unavailable.- Author:
- Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
-
-
Constructor Summary
Constructors Constructor Description RetryableRecordWriter(RecordWriter<P> delegate, RetryPolicy retryPolicy)Create a newRetryableRecordWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the writervoidopen()Open the writer.voidwriteRecords(Batch<P> batch)Write a batch of records to a data sink.
-
-
-
Constructor Detail
-
RetryableRecordWriter
public RetryableRecordWriter(RecordWriter<P> delegate, RetryPolicy retryPolicy)
Create a newRetryableRecordWriter.- Parameters:
delegate- record writerretryPolicy- to apply
-
-
Method Detail
-
open
public void open() throws java.lang.ExceptionDescription copied from interface:RecordWriterOpen the writer.- Specified by:
openin 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: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
-
close
public void close() throws java.lang.ExceptionDescription copied from interface:RecordWriterClose the writer- Specified by:
closein interfaceRecordWriter<P>- Throws:
java.lang.Exception- if an error occurs during closing the writer
-
-