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
,Function
,RichFunction
,AsyncFunction<IN,OUT>
- Direct Known Subclasses:
AsyncFunctionRunner
,AsyncLookupJoinRunner
@PublicEvolving public abstract class RichAsyncFunction<IN,OUT> extends AbstractRichFunction implements AsyncFunction<IN,OUT>
Rich variant of theAsyncFunction
. As aRichFunction
, it gives access to theRuntimeContext
and provides setup and teardown methods:RichFunction.open(OpenContext)
andRichFunction.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RichAsyncFunction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
asyncInvoke(IN input, ResultFuture<OUT> resultFuture)
Trigger async operation for each stream input.void
setRuntimeContext(RuntimeContext runtimeContext)
Sets the function's runtime context.-
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
close, getIterationRuntimeContext, getRuntimeContext, open
-
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.async.AsyncFunction
timeout
-
-
-
-
Method Detail
-
setRuntimeContext
public void setRuntimeContext(RuntimeContext runtimeContext)
Description copied from interface:RichFunction
Sets the function's runtime context. Called by the framework when creating a parallel instance of the function.- Specified by:
setRuntimeContext
in interfaceRichFunction
- Overrides:
setRuntimeContext
in classAbstractRichFunction
- Parameters:
runtimeContext
- The runtime context.
-
asyncInvoke
public abstract void asyncInvoke(IN input, ResultFuture<OUT> resultFuture) throws Exception
Description copied from interface:AsyncFunction
Trigger async operation for each stream input.- Specified by:
asyncInvoke
in 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.
-
-