Class KeyedStateReaderFunction<K,​OUT>

  • Type Parameters:
    K - Type of the keys
    OUT - Type of the output elements.
    All Implemented Interfaces:
    Serializable, org.apache.flink.api.common.functions.Function, org.apache.flink.api.common.functions.RichFunction

    @PublicEvolving
    public abstract class KeyedStateReaderFunction<K,​OUT>
    extends org.apache.flink.api.common.functions.AbstractRichFunction
    A function that processes keys from a restored operator

    For every key readKey(Object, Context, Collector) is invoked. This can produce zero or more elements as output.

    NOTE: State descriptors must be eagerly registered in open(OpenContext). Any attempt to dynamically register states inside of readKey will result in a RuntimeException.

    NOTE: A KeyedStateReaderFunction is always a RichFunction. Therefore, access to the RuntimeContext is always available and setup and teardown methods can be implemented. See RichFunction.open(OpenContext) and RichFunction.close().

    See Also:
    Serialized Form
    • Constructor Detail

      • KeyedStateReaderFunction

        public KeyedStateReaderFunction()
    • Method Detail

      • readKey

        public abstract void readKey​(K key,
                                     KeyedStateReaderFunction.Context ctx,
                                     org.apache.flink.util.Collector<OUT> out)
                              throws Exception
        Process one key from the restored state backend.

        This function can read partitioned state from the restored state backend and output zero or more elements using the Collector parameter.

        Parameters:
        key - The input value.
        out - The collector for returning result values.
        Throws:
        Exception - This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.