Package org.apache.pulsar.functions.api
Interface Function<I,O>
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()Called once to properly close resources when function instance is stopped.default voidinitialize(Context context)Called once to initialize resources when function instance is started.Oprocess(I input, Context context)Process the input.
-
-
-
Method Detail
-
process
O process(I input, Context context) throws java.lang.Exception
Process the input.- Returns:
- the output
- Throws:
java.lang.Exception
-
initialize
default void initialize(Context context) throws java.lang.Exception
Called once to initialize resources when function instance is started.- Parameters:
context- The Function context- Throws:
java.lang.Exception
-
close
default void close() throws java.lang.ExceptionCalled once to properly close resources when function instance is stopped.- Throws:
java.lang.Exception
-
-