Class RichAsyncFunction<IN,OUT>
java.lang.Object
org.apache.flink.api.common.functions.AbstractRichFunction
org.apache.flink.streaming.api.functions.async.RichAsyncFunction<IN,OUT>
- Type Parameters:
IN- The type of the input elements.OUT- The type of the returned elements.
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.functions.Function,org.apache.flink.api.common.functions.RichFunction,AsyncFunction<IN,OUT>
@PublicEvolving
public abstract class RichAsyncFunction<IN,OUT>
extends org.apache.flink.api.common.functions.AbstractRichFunction
implements AsyncFunction<IN,OUT>
Rich variant of the
AsyncFunction. As a RichFunction, it gives access to the
RuntimeContext and provides setup and teardown methods: RichFunction.open(OpenContext) and RichFunction.close().
State related apis in RuntimeContext are not supported yet because the key may get
changed while accessing states in the working thread.
IterationRuntimeContext.getIterationAggregator(String) is not supported since the
aggregator may be modified by multiple threads.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidasyncInvoke(IN input, ResultFuture<OUT> resultFuture) Trigger async operation for each stream input.voidsetRuntimeContext(org.apache.flink.api.common.functions.RuntimeContext runtimeContext) Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
close, getIterationRuntimeContext, getRuntimeContext, openMethods 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.async.AsyncFunction
timeout
-
Constructor Details
-
RichAsyncFunction
public RichAsyncFunction()
-
-
Method Details
-
setRuntimeContext
public void setRuntimeContext(org.apache.flink.api.common.functions.RuntimeContext runtimeContext) - Specified by:
setRuntimeContextin interfaceorg.apache.flink.api.common.functions.RichFunction- Overrides:
setRuntimeContextin classorg.apache.flink.api.common.functions.AbstractRichFunction
-
asyncInvoke
Description copied from interface:AsyncFunctionTrigger async operation for each stream input.- Specified by:
asyncInvokein interfaceAsyncFunction<IN,OUT> - Parameters:
input- element coming from an upstream taskresultFuture- to be completed with the result data- Throws:
Exception- in case of a user code error. An exception will make the task fail and trigger fail-over process.
-