Package org.apache.flink.cep.functions
Class PatternProcessFunction<IN,OUT>
java.lang.Object
org.apache.flink.api.common.functions.AbstractRichFunction
org.apache.flink.cep.functions.PatternProcessFunction<IN,OUT>
- Type Parameters:
IN- type of incoming elementsOUT- type of produced elements based on found matches
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.functions.Function,org.apache.flink.api.common.functions.RichFunction
- Direct Known Subclasses:
PatternFlatSelectAdapter,PatternSelectAdapter
@PublicEvolving
public abstract class PatternProcessFunction<IN,OUT>
extends org.apache.flink.api.common.functions.AbstractRichFunction
It is called with a map of detected events which are identified by their names. The names are
defined by the
Pattern specifying the sought-after pattern.
This is the preferred way to process found matches.
PatternStream<IN> pattern = ...
DataStream<OUT> result = pattern.process(new MyPatternProcessFunction());
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceGives access to time related characteristics as well as enables emitting elements to side outputs. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidprocessMatch(Map<String, List<IN>> match, PatternProcessFunction.Context ctx, org.apache.flink.util.Collector<OUT> out) Generates resulting elements given a map of detected pattern events.Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContext
-
Constructor Details
-
PatternProcessFunction
public PatternProcessFunction()
-
-
Method Details
-
processMatch
public abstract void processMatch(Map<String, List<IN>> match, PatternProcessFunction.Context ctx, org.apache.flink.util.Collector<OUT> out) throws ExceptionGenerates resulting elements given a map of detected pattern events. The events are identified by their specified names.TimeContext.timestamp()in this case returns the time of the last element that was assigned to the match, resulting in this partial match being finished.- Parameters:
match- map containing the found pattern. Events are identified by their names.ctx- enables access to time features and emitting results through side outputsout- Collector used to output the generated elements- Throws:
Exception- This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.
-