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 aRecordReader
retryable whenever the data source is temporarily unavailable.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
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 void
close()
Close the reader.void
open()
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.Exception
Description copied from interface:RecordReader
Open the reader.- Specified by:
open
in 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:RecordReader
Read next record from the data source.- Specified by:
readRecord
in interfaceRecordReader<P>
- Returns:
- the next record from the data source or
null
if 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.Exception
Description copied from interface:RecordReader
Close the reader.- Specified by:
close
in interfaceRecordReader<P>
- Throws:
java.lang.Exception
- if an error occurs during reader closing
-
-