Class RichSourceFunction<OUT>

  • Type Parameters:
    OUT - The type of the records produced by this source.
    All Implemented Interfaces:
    Serializable, org.apache.flink.api.common.functions.Function, org.apache.flink.api.common.functions.RichFunction, SourceFunction<OUT>
    Direct Known Subclasses:
    ContinuousFileMonitoringFunction

    @Internal
    public abstract class RichSourceFunction<OUT>
    extends org.apache.flink.api.common.functions.AbstractRichFunction
    implements SourceFunction<OUT>
    Deprecated.
    This class is based on the SourceFunction API, which is due to be removed. Use the new Source API instead.
    Base class for implementing a parallel data source that has access to context information (via AbstractRichFunction.getRuntimeContext()) and additional life-cycle methods (AbstractRichFunction.open(OpenContext) and AbstractRichFunction.close().

    This class is useful when implementing parallel sources where different parallel subtasks need to perform different work. Typical patterns for that are:

    • Use AbstractRichFunction.getRuntimeContext() to obtain the runtime context.
    • Use the number of parallel subtasks in RuntimeContext.getTaskInfo() to determine the current parallelism. It is strongly encouraged to use this method, rather than hard-wiring the parallelism, because the configured parallelism may change depending on program configuration. The parallelism may also change after recovering failures, when fewer than desired parallel worker as available.
    • Use the index of task in RuntimeContext.getTaskInfo()} to determine which subtask the current instance of the function executes.
    See Also:
    Serialized Form
    • Constructor Detail

      • RichSourceFunction

        public RichSourceFunction()
        Deprecated.