IN
- Type of the input elementsKEY
- Type of the key on which the input stream is keyedOUT
- Type of the output elementspublic abstract class AbstractKeyedCEPPatternOperator<IN,KEY,OUT> extends AbstractCEPBasePatternOperator<IN,OUT>
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.AbstractStreamOperator.CountingOutput
INITIAL_PRIORITY_QUEUE_CAPACITY
chainingStrategy, LOG, metrics, output
Constructor and Description |
---|
AbstractKeyedCEPPatternOperator(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)
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.
|
protected void |
updateNFA(NFA<IN> nfa) |
protected void |
updatePriorityQueue(PriorityQueue<StreamRecord<IN>> queue) |
advanceTime, getInputSerializer, processEvent
close, dispose, getChainingStrategy, getContainingTask, getCurrentProcessingTime, getExecutionConfig, getMetricGroup, getOperatorConfig, getOperatorName, getPartitionedState, getPartitionedState, getRuntimeContext, getStateBackend, getUserCodeClassloader, notifyOfCompletedCheckpoint, registerTimer, setChainingStrategy, setKeyContext, setKeyContextElement1, setKeyContextElement2, setup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, dispose, getChainingStrategy, getMetricGroup, notifyOfCompletedCheckpoint, setChainingStrategy, setKeyContextElement1, setKeyContextElement2, setup
public AbstractKeyedCEPPatternOperator(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.
open
in interface StreamOperator<OUT>
open
in class AbstractStreamOperator<OUT>
Exception
- An exception in this method causes the operator to fail.protected NFA<IN> getNFA() throws IOException
getNFA
in class AbstractCEPBasePatternOperator<IN,OUT>
IOException
protected void updateNFA(NFA<IN> nfa) throws IOException
updateNFA
in class AbstractCEPBasePatternOperator<IN,OUT>
IOException
protected PriorityQueue<StreamRecord<IN>> getPriorityQueue() throws IOException
getPriorityQueue
in class AbstractCEPBasePatternOperator<IN,OUT>
IOException
protected void updatePriorityQueue(PriorityQueue<StreamRecord<IN>> queue) throws IOException
updatePriorityQueue
in class AbstractCEPBasePatternOperator<IN,OUT>
IOException
public void processElement(StreamRecord<IN> element) throws Exception
OneInputStreamOperator
processElement
in interface OneInputStreamOperator<IN,OUT>
processElement
in class AbstractCEPBasePatternOperator<IN,OUT>
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<OUT>
snapshotOperatorState
in class AbstractStreamOperator<OUT>
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) throws Exception
StreamOperator
This method is called after StreamOperator.setup(StreamTask, StreamConfig, Output)
and before StreamOperator.open()
.
restoreState
in interface StreamOperator<OUT>
restoreState
in class AbstractStreamOperator<OUT>
state
- The state of operator that was snapshotted as part of checkpoint
from which the execution is restored.Exception
- 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.