Package org.jeasy.batch.core.reader
Class RetryableRecordReader<P>
- java.lang.Object
-
- org.jeasy.batch.core.reader.RetryableRecordReader<P>
-
- Type Parameters:
P- type of the record's payload
- All Implemented Interfaces:
RecordReader<P>
public class RetryableRecordReader<P> extends java.lang.Object implements RecordReader<P>
Decorator that makes aRecordReaderretryable whenever the data source is temporarily unavailable.- Author:
- Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
-
-
Constructor Summary
Constructors Constructor Description RetryableRecordReader(RecordReader<P> delegate, RetryPolicy retryPolicy)Create a newRetryableRecordReader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the reader.voidopen()Open the reader.Record<P>readRecord()Read next record from the data source.
-
-
-
Constructor Detail
-
RetryableRecordReader
public RetryableRecordReader(RecordReader<P> delegate, RetryPolicy retryPolicy)
Create a newRetryableRecordReader.- Parameters:
delegate- record readerretryPolicy- to apply
-
-
Method Detail
-
open
public void open() throws java.lang.ExceptionDescription copied from interface:RecordReaderOpen the reader.- Specified by:
openin interfaceRecordReader<P>- Throws:
java.lang.Exception- if an error occurs during reader opening
-
readRecord
public Record<P> readRecord() throws java.lang.Exception
Description copied from interface:RecordReaderRead next record from the data source.- Specified by:
readRecordin interfaceRecordReader<P>- Returns:
- the next record from the data source or
nullif the end of the data source is reached - Throws:
java.lang.Exception- if an error occurs during reading next record
-
close
public void close() throws java.lang.ExceptionDescription copied from interface:RecordReaderClose the reader.- Specified by:
closein interfaceRecordReader<P>- Throws:
java.lang.Exception- if an error occurs during reader closing
-
-