@Internal public abstract class AbstractAsyncStateStreamOperatorV2<OUT> extends AbstractStreamOperatorV2<OUT> implements AsyncStateProcessingOperator
AbstractStreamOperatorV2 the ability to
perform AsyncStateProcessing. The aim is to make any subclass of AbstractStreamOperatorV2 could manipulate async state with only a change of base class.combinedWatermark, config, lastRecordAttributes, latencyStats, LOG, metrics, output, processingTimeService, stateHandler, timeServiceManager| 构造器和说明 |
|---|
AbstractAsyncStateStreamOperatorV2(StreamOperatorParameters<OUT> parameters,
int numberOfInputs) |
| 限定符和类型 | 方法和说明 |
|---|---|
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
AbstractStreamOperatorV2. |
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,
int inputId) |
<T> void |
setAsyncKeyedContextElement(StreamRecord<T> record,
org.apache.flink.api.java.functions.KeySelector<T,?> keySelector)
Set key context for async state processing.
|
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, getCurrentKey, getExecutionConfig, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getTimeServiceManager, getUserCodeClassloader, initializeState, internalSetKeyContextElement, isUsingCustomRawKeyedState, notifyCheckpointAborted, notifyCheckpointComplete, open, prepareSnapshotPreBarrier, processRecordAttributes, reportOrForwardLatencyMarker, reportWatermark, setCurrentKey, setKeyContextElement1, setKeyContextElement2, snapshotState, useSplittableTimersclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmakeRecordProcessorgetOperatorAttributespublic AbstractAsyncStateStreamOperatorV2(StreamOperatorParameters<OUT> parameters, int numberOfInputs)
public final void initializeState(StreamTaskStateInitializer streamTaskStateManager) throws Exception
AbstractStreamOperatorV2.initializeState 在接口中 StreamOperator<OUT>initializeState 在类中 AbstractStreamOperatorV2<OUT>Exceptionpublic boolean isAsyncStateProcessingEnabled()
AsyncStateProcessingisAsyncStateProcessingEnabled 在接口中 AsyncStateProcessingpublic ElementOrder getElementOrder()
AsyncStateProcessingOperatorElementOrder of this operator.getElementOrder 在接口中 AsyncStateProcessingOperatorpublic final <T> void setAsyncKeyedContextElement(StreamRecord<T> record, org.apache.flink.api.java.functions.KeySelector<T,?> keySelector) throws Exception
AsyncStateProcessingOperatorsetAsyncKeyedContextElement 在接口中 AsyncStateProcessingOperatorT - the type of the record.record - the record.keySelector - the key selector to select a key from record.Exceptionpublic final void postProcessElement()
AsyncStateProcessingOperatorprocessElement.public final void preserveRecordOrderAndProcess(org.apache.flink.util.function.ThrowingRunnable<Exception> processing)
AsyncStateProcessingOperatorAsyncStateProcessingOperator.getElementOrder() returns ElementOrder.RECORD_ORDER.preserveRecordOrderAndProcess 在接口中 AsyncStateProcessingOperatorprocessing - the record processing logic.public final <T> org.apache.flink.util.function.ThrowingConsumer<StreamRecord<T>,Exception> getRecordProcessor(int inputId)
AsyncStateProcessinggetRecordProcessor 在接口中 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 在接口中 StreamOperator<OUT>snapshotState 在类中 AbstractStreamOperatorV2<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)
AbstractStreamOperatorV2InternalTimerService 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 在类中 AbstractStreamOperatorV2<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 processWatermark(Watermark mark) throws Exception
processWatermark 在类中 AbstractStreamOperatorV2<OUT>Exceptionpublic void processWatermarkStatus(WatermarkStatus watermarkStatus, int inputId) throws Exception
processWatermarkStatus 在类中 AbstractStreamOperatorV2<OUT>ExceptionCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.