接口 Function<I,O>

函数接口:
这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

@Public @Stable @FunctionalInterface public interface Function<I,O>
This is the core interface of the function api. The process is called for every message of the input topic of the function. The incoming input bytes are converted to the input type I for simple Java types(String, Integer, Boolean, Map, and List types) and for org.Json type. If this serialization approach does not meet your needs, you can use the byte stream handler defined in RawRequestHandler.
  • 方法概要

    修饰符和类型
    方法
    说明
    default void
    Called once to properly close resources when function instance is stopped.
    default void
    Called once to initialize resources when function instance is started.
    process(I input, Context context)
    Process the input.
  • 方法详细资料

    • process

      O process(I input, Context context) throws Exception
      Process the input.
      返回:
      the output
      抛出:
      Exception
    • initialize

      default void initialize(Context context) throws Exception
      Called once to initialize resources when function instance is started.
      参数:
      context - The Function context
      抛出:
      Exception
    • close

      default void close() throws Exception
      Called once to properly close resources when function instance is stopped.
      抛出:
      Exception