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.This class is based on theSourceFunctionAPI, which is due to be removed. Use the newSourceAPI instead.Base class for implementing a parallel data source that has access to context information (viaAbstractRichFunction.getRuntimeContext()) and additional life-cycle methods (AbstractRichFunction.open(OpenContext)andAbstractRichFunction.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.functions.source.legacy.SourceFunction
SourceFunction.SourceContext<T>
-
-
Constructor Summary
Constructors Constructor Description RichSourceFunction()Deprecated.
-
Method Summary
-
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.streaming.api.functions.source.legacy.SourceFunction
cancel, run
-
-