@Internal public abstract class AbstractAsyncStateStreamOperator<OUT> extends AbstractStreamOperator<OUT> implements AsyncStateProcessingOperator
AbstractStreamOperator the ability to
perform AsyncStateProcessing. The aim is to make any subclass of AbstractStreamOperator could manipulate async state with only a change of base class.chainingStrategy, config, lastRecordAttributes1, lastRecordAttributes2, latencyStats, LOG, metrics, output, processingTimeService, stateHandler, stateKeySelector1, stateKeySelector2, timeServiceManager| Constructor and Description |
|---|
AbstractAsyncStateStreamOperator() |
| Modifier and Type | Method and Description |
|---|---|
Object |
getCurrentKey() |
ElementOrder |
getElementOrder()
Get the
ElementOrder of this operator. |
<K,N> InternalTimerService<N> |
getInternalTimerService(String name,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
Triggerable<K,N> triggerable)
Returns a
InternalTimerService that can be used to query current processing time and
event time and to set timers. |
<T> org.apache.flink.util.function.ThrowingConsumer<StreamRecord<T>,Exception> |
getRecordProcessor(int inputId)
Get the record processor that could process record from input, which is the only entry for
async processing.
|
void |
initializeState(StreamTaskStateInitializer streamTaskStateManager)
Initialize necessary state components for
AbstractStreamOperator. |
boolean |
isAsyncStateProcessingEnabled()
Get if the async state processing is enabled for this input/operator.
|
void |
postProcessElement()
A callback that will be triggered after an element finishes
processElement. |
void |
preserveRecordOrderAndProcess(org.apache.flink.util.function.ThrowingRunnable<Exception> processing)
Check the order of same-key record, and then process the record.
|
void |
processWatermark(Watermark mark) |
void |
processWatermarkStatus(WatermarkStatus watermarkStatus) |
<T> void |
setAsyncKeyedContextElement(StreamRecord<T> record,
org.apache.flink.api.java.functions.KeySelector<T,?> keySelector)
Set key context for async state processing.
|
void |
setKeyContextElement1(StreamRecord record) |
void |
setKeyContextElement2(StreamRecord record) |
OperatorSnapshotFutures |
snapshotState(long checkpointId,
long timestamp,
org.apache.flink.runtime.checkpoint.CheckpointOptions checkpointOptions,
org.apache.flink.runtime.state.CheckpointStreamFactory factory)
Called to draw a state snapshot from the operator.
|
close, finish, getChainingStrategy, getContainingTask, getExecutionConfig, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getStateKeySelector1, getStateKeySelector2, getTimeServiceManager, getUserCodeClassloader, hasKeyContext1, hasKeyContext2, initializeState, isUsingCustomRawKeyedState, notifyCheckpointAborted, notifyCheckpointComplete, open, prepareSnapshotPreBarrier, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processRecordAttributes, processRecordAttributes1, processRecordAttributes2, processWatermark1, processWatermark2, processWatermarkStatus1, processWatermarkStatus2, reportOrForwardLatencyMarker, setChainingStrategy, setCurrentKey, setMailboxExecutor, setProcessingTimeService, setup, snapshotState, useSplittableTimersclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmakeRecordProcessorgetOperatorAttributeshasKeyContextpublic void initializeState(StreamTaskStateInitializer streamTaskStateManager) throws Exception
AbstractStreamOperator.initializeState in interface StreamOperator<OUT>initializeState in class AbstractStreamOperator<OUT>Exceptionpublic boolean isAsyncStateProcessingEnabled()
AsyncStateProcessingisAsyncStateProcessingEnabled in interface AsyncStateProcessingpublic ElementOrder getElementOrder()
AsyncStateProcessingOperatorElementOrder of this operator.getElementOrder in interface AsyncStateProcessingOperatorpublic final <T> void setAsyncKeyedContextElement(StreamRecord<T> record, org.apache.flink.api.java.functions.KeySelector<T,?> keySelector) throws Exception
AsyncStateProcessingOperatorsetAsyncKeyedContextElement in interface AsyncStateProcessingOperatorT - the type of the record.record - the record.keySelector - the key selector to select a key from record.Exceptionpublic final void postProcessElement()
AsyncStateProcessingOperatorprocessElement.postProcessElement in interface AsyncStateProcessingOperatorpublic final void preserveRecordOrderAndProcess(org.apache.flink.util.function.ThrowingRunnable<Exception> processing)
AsyncStateProcessingOperatorAsyncStateProcessingOperator.getElementOrder() returns ElementOrder.RECORD_ORDER.preserveRecordOrderAndProcess in interface AsyncStateProcessingOperatorprocessing - the record processing logic.public final <T> org.apache.flink.util.function.ThrowingConsumer<StreamRecord<T>,Exception> getRecordProcessor(int inputId)
AsyncStateProcessinggetRecordProcessor in interface AsyncStateProcessinginputId - the input identifier, start from 1. Borrow the design from org.apache.flink.streaming.api.operators.AbstractInput#inputId. This is only relevant if
there is multiple inputs for the instance.public final OperatorSnapshotFutures snapshotState(long checkpointId, long timestamp, org.apache.flink.runtime.checkpoint.CheckpointOptions checkpointOptions, org.apache.flink.runtime.state.CheckpointStreamFactory factory) throws Exception
StreamOperatorsnapshotState in interface StreamOperator<OUT>snapshotState in class AbstractStreamOperator<OUT>Exception - exception that happened during snapshotting.public <K,N> InternalTimerService<N> getInternalTimerService(String name, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, Triggerable<K,N> triggerable)
InternalTimerService that can be used to query current processing time and
event time and to set timers. An operator can have several timer services, where each has its
own namespace serializer. Timer services are differentiated by the string key that is given
when requesting them, if you call this method with the same key multiple times you will get
the same timer service instance in subsequent requests.
Timers are always scoped to a key, the currently active key of a keyed stream operation. When a timer fires, this key will also be set as the currently active key.
Each timer has attached metadata, the namespace. Different timer services can have a
different namespace type. If you don't need namespace differentiation you can use VoidNamespaceSerializer as the namespace serializer.
getInternalTimerService in class AbstractStreamOperator<OUT>N - The type of the timer namespace.name - The name of the requested timer service. If no service exists under the given
name a new one will be created and returned.namespaceSerializer - TypeSerializer for the timer namespace.triggerable - The Triggerable that should be invoked when timers firepublic void setKeyContextElement1(StreamRecord record) throws Exception
setKeyContextElement1 in interface StreamOperator<OUT>setKeyContextElement1 in class AbstractStreamOperator<OUT>Exceptionpublic void setKeyContextElement2(StreamRecord record) throws Exception
setKeyContextElement2 in interface StreamOperator<OUT>setKeyContextElement2 in class AbstractStreamOperator<OUT>Exceptionpublic Object getCurrentKey()
getCurrentKey in interface KeyContextgetCurrentKey in class AbstractStreamOperator<OUT>public void processWatermark(Watermark mark) throws Exception
processWatermark in class AbstractStreamOperator<OUT>Exceptionpublic void processWatermarkStatus(WatermarkStatus watermarkStatus) throws Exception
processWatermarkStatus in class AbstractStreamOperator<OUT>ExceptionCopyright © 2014–2025 The Apache Software Foundation. All rights reserved.