K - Type of the keysOUT - Type of the output elements.@PublicEvolving
public abstract class KeyedStateReaderFunction<K,OUT>
extends org.apache.flink.api.common.functions.AbstractRichFunction
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(Configuration). 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(Configuration) and RichFunction.close().
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
KeyedStateReaderFunction.Context
Context that
KeyedStateReaderFunction's can use for getting additional data about an input
record. |
| 构造器和说明 |
|---|
KeyedStateReaderFunction() |
| 限定符和类型 | 方法和说明 |
|---|---|
abstract void |
open(org.apache.flink.configuration.Configuration parameters)
Initialization method for the function.
|
abstract void |
readKey(K key,
KeyedStateReaderFunction.Context ctx,
org.apache.flink.util.Collector<OUT> out)
Process one key from the restored state backend.
|
public abstract void open(org.apache.flink.configuration.Configuration parameters)
throws Exception
readKey(Object,
Context, Collector) and thus suitable for one time setup work.
This is the only method that my register state descriptors within a KeyedStateReaderFunction.
open 在接口中 org.apache.flink.api.common.functions.RichFunctionopen 在类中 org.apache.flink.api.common.functions.AbstractRichFunctionExceptionpublic abstract void readKey(K key, KeyedStateReaderFunction.Context ctx, org.apache.flink.util.Collector<OUT> out) throws Exception
This function can read partitioned state from the restored state backend and output zero or
more elements using the Collector parameter.
key - The input value.out - The collector for returning result values.Exception - This method may throw exceptions. Throwing an exception will cause the
operation to fail and may trigger recovery.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.