OUT
- The type of the records produced by this source.@Public public abstract class RichSourceFunction<OUT> extends AbstractRichFunction implements SourceFunction<OUT>
AbstractRichFunction.getRuntimeContext()
) and additional life-cycle methods (AbstractRichFunction.open(org.apache.flink.configuration.Configuration)
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:
AbstractRichFunction.getRuntimeContext()
to obtain the runtime context.
RuntimeContext.getNumberOfParallelSubtasks()
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.
RuntimeContext.getIndexOfThisSubtask()
to
determine which subtask the current instance of the function executes.
SourceFunction.SourceContext<T>
Constructor and Description |
---|
RichSourceFunction() |
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancel, run
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.