IN
- The type of the input elements.OUT
- The type of the returned elements.@PublicEvolving public abstract class RichAsyncFunction<IN,OUT> extends AbstractRichFunction implements AsyncFunction<IN,OUT>
AsyncFunction
. As a RichFunction
, it gives access to the
RuntimeContext
and provides setup and teardown methods: RichFunction.open(org.apache.flink.configuration.Configuration)
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.
Constructor and Description |
---|
RichAsyncFunction() |
Modifier and Type | Method and 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.
|
close, getIterationRuntimeContext, getRuntimeContext, open
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
timeout
public void setRuntimeContext(RuntimeContext runtimeContext)
RichFunction
setRuntimeContext
in interface RichFunction
setRuntimeContext
in class AbstractRichFunction
runtimeContext
- The runtime context.public abstract void asyncInvoke(IN input, ResultFuture<OUT> resultFuture) throws Exception
AsyncFunction
asyncInvoke
in interface AsyncFunction<IN,OUT>
input
- element coming from an upstream taskresultFuture
- to be completed with the result dataException
- in case of a user code error. An exception will make the task fail and
trigger fail-over process.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.