Class TimedBlockingReader

java.lang.Object
io.debezium.connector.mysql.legacy.BlockingReader
io.debezium.connector.mysql.legacy.TimedBlockingReader
All Implemented Interfaces:
Reader

public class TimedBlockingReader extends BlockingReader
A component that blocks doing nothing for a specified period of time or until the connector task is stopped
Author:
Peter Goransson
  • Field Details

    • logger

      protected final org.slf4j.Logger logger
    • timeout

      private final Duration timeout
    • timer

      private volatile Threads.Timer timer
  • Constructor Details

    • TimedBlockingReader

      public TimedBlockingReader(String name, Duration timeout)
      Parameters:
      name - Name of the reader
      timeout - Duration of time until this TimedBlockingReader should stop
  • Method Details

    • start

      public void start(MySqlPartition partition)
      Description copied from interface: Reader
      Start the reader and return immediately. Once started, the SourceRecords generated by the reader can be obtained by periodically calling Reader.poll() until that method returns null.

      This method does nothing if it is already running.

      Specified by:
      start in interface Reader
      Overrides:
      start in class BlockingReader
    • poll

      public List<org.apache.kafka.connect.source.SourceRecord> poll() throws InterruptedException
      Description copied from class: BlockingReader
      Does nothing until the connector task is shut down, but regularly returns control back to Connect in order for being paused if requested.
      Specified by:
      poll in interface Reader
      Overrides:
      poll in class BlockingReader
      Returns:
      the list of source records that may or may not be empty; or null when there will be no more records because the reader has completely Reader.State.STOPPED.
      Throws:
      InterruptedException - if this thread is interrupted while waiting for more records