com.ibm.streamsx.topology.function

Interface Initializable



  • public interface Initializable
    Optional interface that a function can implement to perform initialization.

    initialize(FunctionContext) is called prior to the function being called to produce or process stream tuples. This will be when:

    • the processing element (PE) containing the function starts.
    • the PE restarts after a failure or manual request.
    • the function is restored from a checkpoint.

    Initialization is used open resources that cannot be part of the function's serialized state, such as files or connections to external systems. Custom metrics can also be created using createCustomMetric().
    A function that implements this interface may also implement java.lang.AutoCloseable to close any resources opened in initialize(FunctionContext).

    • Method Detail

      • initialize

        void initialize(FunctionContext functionContext)
                 throws java.lang.Exception
        Initialize this function.
        Parameters:
        functionContext - Context the function is executing in.
        Throws:
        java.lang.Exception - Exception initializing function.
streamsx.topology 2.1 @ IBMStreams GitHub