Class FlinkBoundedSourceReader<T>

  • Type Parameters:
    T - the output element type of the encapsulated Beam BoundedReader.
    All Implemented Interfaces:
    java.lang.AutoCloseable, org.apache.flink.api.common.state.CheckpointListener, org.apache.flink.api.connector.source.SourceReader<org.apache.beam.sdk.values.WindowedValue<T>,​FlinkSourceSplit<T>>

    public class FlinkBoundedSourceReader<T>
    extends FlinkSourceReaderBase<T,​org.apache.beam.sdk.values.WindowedValue<T>>
    A Flink SourceReader implementation that reads from the assigned FlinkSourceSplits by using Beam BoundedReaders.

    This reader consumes the source splits one by one sequentially, instead of concurrently.

    • Constructor Detail

      • FlinkBoundedSourceReader

        public FlinkBoundedSourceReader​(java.lang.String stepName,
                                        org.apache.flink.api.connector.source.SourceReaderContext context,
                                        org.apache.beam.sdk.options.PipelineOptions pipelineOptions,
                                        @Nullable
                                        java.util.function.Function<org.apache.beam.sdk.values.WindowedValue<T>,​java.lang.Long> timestampExtractor)
      • FlinkBoundedSourceReader

        protected FlinkBoundedSourceReader​(java.lang.String stepName,
                                           org.apache.flink.api.connector.source.SourceReaderContext context,
                                           org.apache.beam.sdk.options.PipelineOptions pipelineOptions,
                                           java.util.concurrent.ScheduledExecutorService executor,
                                           @Nullable
                                           java.util.function.Function<org.apache.beam.sdk.values.WindowedValue<T>,​java.lang.Long> timestampExtractor)
    • Method Detail

      • pollNext

        public org.apache.flink.core.io.InputStatus pollNext​(org.apache.flink.api.connector.source.ReaderOutput<org.apache.beam.sdk.values.WindowedValue<T>> output)
                                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • isAvailableForAliveReaders

        protected java.util.concurrent.CompletableFuture<java.lang.Void> isAvailableForAliveReaders()
        Description copied from class: FlinkSourceReaderBase
        This method needs to be overridden by subclasses to determine if data is available when there are alive readers. For example, an unbounded source may not have any source split ready for data emission even if all the sources are still alive. Whereas for the bounded source, data is always available as long as there are alive readers.
        Specified by:
        isAvailableForAliveReaders in class FlinkSourceReaderBase<T,​org.apache.beam.sdk.values.WindowedValue<T>>