Class RichSourceFunction<OUT>
java.lang.Object
org.apache.flink.api.common.functions.AbstractRichFunction
org.apache.flink.streaming.api.functions.source.legacy.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.
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.functions.source.legacy.SourceFunction
SourceFunction.SourceContext<T> -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.streaming.api.functions.source.legacy.SourceFunction
cancel, run
-
Constructor Details
-
RichSourceFunction
public RichSourceFunction()Deprecated.
-
SourceFunctionAPI, which is due to be removed. Use the newSourceAPI instead.