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 aRecordWriter
retryable whenever the data sink is temporarily unavailable.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
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 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
-
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.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
-
-