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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    asyncInvoke(IN input, ResultFuture<OUT> resultFuture)
    Trigger async operation for each stream input.
    void
    setRuntimeContext(org.apache.flink.api.common.functions.RuntimeContext runtimeContext)
     

    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
  • Constructor Details

    • RichAsyncFunction

      public RichAsyncFunction()
  • Method Details

    • setRuntimeContext

      public void setRuntimeContext(org.apache.flink.api.common.functions.RuntimeContext runtimeContext)
      Specified by:
      setRuntimeContext in interface org.apache.flink.api.common.functions.RichFunction
      Overrides:
      setRuntimeContext in class org.apache.flink.api.common.functions.AbstractRichFunction
    • 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 interface AsyncFunction<IN,OUT>
      Parameters:
      input - element coming from an upstream task
      resultFuture - 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.