Class FromElementsSourceReader<T>

java.lang.Object
org.apache.flink.connector.testframe.source.FromElementsSourceReader<T>
All Implemented Interfaces:
AutoCloseable, org.apache.flink.api.common.state.CheckpointListener, org.apache.flink.api.connector.source.SourceReader<T,FromElementsSplit>

public class FromElementsSourceReader<T> extends Object implements org.apache.flink.api.connector.source.SourceReader<T,FromElementsSplit>
A SourceReader implementation that reads data from a FromElementsSource.ElementsSupplier. If limitedNum is set, the reader will stop reading at the limitedNum position until the checkpoint or savepoint triggered.
  • Constructor Details

    • FromElementsSourceReader

      public FromElementsSourceReader(Integer limitedNum, FromElementsSource.ElementsSupplier<T> elementsSupplier, org.apache.flink.api.connector.source.Boundedness boundedness, org.apache.flink.api.connector.source.SourceReaderContext context)
  • Method Details

    • start

      public void start()
      Specified by:
      start in interface org.apache.flink.api.connector.source.SourceReader<T,FromElementsSplit>
    • pollNext

      public org.apache.flink.core.io.InputStatus pollNext(org.apache.flink.api.connector.source.ReaderOutput<T> output) throws Exception
      Specified by:
      pollNext in interface org.apache.flink.api.connector.source.SourceReader<T,FromElementsSplit>
      Throws:
      Exception
    • snapshotState

      public List<FromElementsSplit> snapshotState(long checkpointId)
      Specified by:
      snapshotState in interface org.apache.flink.api.connector.source.SourceReader<T,FromElementsSplit>
    • isAvailable

      public CompletableFuture<Void> isAvailable()
      Specified by:
      isAvailable in interface org.apache.flink.api.connector.source.SourceReader<T,FromElementsSplit>
    • addSplits

      public void addSplits(List<FromElementsSplit> splits)
      Specified by:
      addSplits in interface org.apache.flink.api.connector.source.SourceReader<T,FromElementsSplit>
    • notifyNoMoreSplits

      public void notifyNoMoreSplits()
      Specified by:
      notifyNoMoreSplits in interface org.apache.flink.api.connector.source.SourceReader<T,FromElementsSplit>
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • notifyCheckpointComplete

      public void notifyCheckpointComplete(long checkpointId) throws Exception
      Specified by:
      notifyCheckpointComplete in interface org.apache.flink.api.common.state.CheckpointListener
      Specified by:
      notifyCheckpointComplete in interface org.apache.flink.api.connector.source.SourceReader<T,FromElementsSplit>
      Throws:
      Exception