IN
- Type of the input elementsKEY
- Type of the key on which the input stream is keyedpublic class KeyedCEPPatternOperator<IN,KEY> extends AbstractCEPPatternOperator<IN>
NFA
and a priority queue to buffer out of order elements. Both data structures are
stored using the key value state. Additionally, the set of all seen keys is kept as part of the
operator state. This is necessary to trigger the execution for all keys upon receiving a new
watermark.INITIAL_PRIORITY_QUEUE_CAPACITY
chainingStrategy, LOG, output
Constructor and Description |
---|
KeyedCEPPatternOperator(TypeSerializer<IN> inputSerializer,
boolean isProcessingTime,
KeySelector<IN,KEY> keySelector,
TypeSerializer<KEY> keySerializer,
NFACompiler.NFAFactory<IN> nfaFactory) |
Modifier and Type | Method and Description |
---|---|
protected NFA<IN> |
getNFA() |
protected PriorityQueue<StreamRecord<IN>> |
getPriorityQueue() |
void |
open()
This method is called immediately before any elements are processed, it should contain the
operator's initialization logic.
|
void |
processElement(StreamRecord<IN> element)
Processes one element that arrived at this operator.
|
void |
processWatermark(Watermark mark)
Processes a
Watermark . |
void |
restoreState(StreamTaskState state,
long recoveryTimestamp)
Restores the operator state, if this operator's execution is recovering from a checkpoint.
|
StreamTaskState |
snapshotOperatorState(long checkpointId,
long timestamp)
Called to draw a state snapshot from the operator.
|
getInputSerializer, processEvent
close, disableInputCopy, dispose, getChainingStrategy, getContainingTask, getExecutionConfig, getOperatorConfig, getPartitionedState, getPartitionedState, getRuntimeContext, getStateBackend, getUserCodeClassloader, isInputCopyingDisabled, notifyOfCompletedCheckpoint, registerTimer, setChainingStrategy, setKeyContext, setKeyContextElement1, setKeyContextElement2, setup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, dispose, getChainingStrategy, isInputCopyingDisabled, notifyOfCompletedCheckpoint, setChainingStrategy, setKeyContextElement1, setKeyContextElement2, setup
public KeyedCEPPatternOperator(TypeSerializer<IN> inputSerializer, boolean isProcessingTime, KeySelector<IN,KEY> keySelector, TypeSerializer<KEY> keySerializer, NFACompiler.NFAFactory<IN> nfaFactory)
public void open() throws Exception
AbstractStreamOperator
The default implementation does nothing.
protected NFA<IN> getNFA() throws IOException
getNFA
in class AbstractCEPPatternOperator<IN>
IOException
protected PriorityQueue<StreamRecord<IN>> getPriorityQueue() throws IOException
getPriorityQueue
in class AbstractCEPPatternOperator<IN>
IOException
public void processElement(StreamRecord<IN> element) throws Exception
OneInputStreamOperator
processElement
in interface OneInputStreamOperator<IN,Map<String,IN>>
processElement
in class AbstractCEPPatternOperator<IN>
Exception
public void processWatermark(Watermark mark) throws Exception
OneInputStreamOperator
Watermark
.
This method is guaranteed to not be called concurrently with other methods of the operator.public StreamTaskState snapshotOperatorState(long checkpointId, long timestamp) throws Exception
StreamOperator
snapshotOperatorState
in interface StreamOperator<Map<String,IN>>
snapshotOperatorState
in class AbstractStreamOperator<Map<String,IN>>
checkpointId
- The ID of the checkpoint.timestamp
- The timestamp of the checkpoint.Exception
- Forwards exceptions that occur while drawing snapshots from the operator
and the key/value state.public void restoreState(StreamTaskState state, long recoveryTimestamp) throws Exception
StreamOperator
This method is called after StreamOperator.setup(StreamTask, StreamConfig, Output)
and before StreamOperator.open()
.
restoreState
in interface StreamOperator<Map<String,IN>>
restoreState
in class AbstractStreamOperator<Map<String,IN>>
state
- The state of operator that was snapshotted as part of checkpoint
from which the execution is restored.recoveryTimestamp
- Global recovery timestampException
- Exceptions during state restore should be forwarded, so that the system can
properly react to failed state restore and fail the execution attempt.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.