Class BlockingQueueRecordReader<P>

  • Type Parameters:
    P - type of the record's payload
    All Implemented Interfaces:
    RecordReader<P>

    public class BlockingQueueRecordReader<P>
    extends java.lang.Object
    implements RecordReader<P>
    A RecordReader that reads record from a BlockingQueue.
    Author:
    Mahmoud Ben Hassine ([email protected])
    • Constructor Detail

      • BlockingQueueRecordReader

        public BlockingQueueRecordReader​(java.util.concurrent.BlockingQueue<Record<P>> queue)
        Parameters:
        queue - the queue to read records from
      • BlockingQueueRecordReader

        public BlockingQueueRecordReader​(java.util.concurrent.BlockingQueue<Record<P>> queue,
                                         long timeout)
        Parameters:
        queue - the queue to read records from
        timeout - in milliseconds after which the reader will return null
    • Method Detail

      • 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 interface RecordReader<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