IN - Input type for the operator.OUT - Output type for the operator.@Internal public class AsyncWaitOperator<IN,OUT> extends AbstractUdfStreamOperator<OUT,AsyncFunction<IN,OUT>> implements OneInputStreamOperator<IN,OUT>, BoundedOneInput
AsyncWaitOperator allows to asynchronously process incoming stream records. For that
the operator creates an ResultFuture which is passed to an AsyncFunction. Within
the async function, the user can complete the async collector arbitrarily. Once the async
collector has been completed, the result is emitted by the operator's emitter to downstream
operators.
The operator offers different output modes depending on the chosen AsyncDataStream.OutputMode. In
order to give exactly once processing guarantees, the operator stores all currently in-flight
StreamElement in it's operator state. Upon recovery the recorded set of stream elements
is replayed.
In case of chaining of this operator, it has to be made sure that the operators in the chain
are opened tail to head. The reason for this is that an opened AsyncWaitOperator starts
already emitting recovered StreamElement to downstream operators.
userFunctionchainingStrategy, config, latencyStats, LOG, metrics, output, processingTimeService| 构造器和说明 |
|---|
AsyncWaitOperator(AsyncFunction<IN,OUT> asyncFunction,
long timeout,
int capacity,
AsyncDataStream.OutputMode outputMode,
ProcessingTimeService processingTimeService,
MailboxExecutor mailboxExecutor) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
endInput()
It is notified that no more data will arrive on the input.
|
void |
initializeState(org.apache.flink.runtime.state.StateInitializationContext context)
Stream operators with state which can be restored need to override this hook method.
|
void |
open()
This method is called immediately before any elements are processed, it should contain the
operator's initialization logic, e.g. state initialization.
|
void |
processElement(StreamRecord<IN> element)
Processes one element that arrived at this operator.
|
void |
processWatermark(Watermark mark)
Processes a
Watermark. |
void |
setup(StreamTask<?,?> containingTask,
StreamConfig config,
Output<StreamRecord<OUT>> output)
Initializes the operator.
|
void |
snapshotState(org.apache.flink.runtime.state.StateSnapshotContext context)
Stream operators with state, which want to participate in a snapshot need to override this
hook method.
|
close, dispose, getUserFunction, getUserFunctionParameters, notifyCheckpointAborted, notifyCheckpointComplete, setOutputTypegetChainingStrategy, getContainingTask, getCurrentKey, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getTimeServiceManager, getUserCodeClassloader, initializeState, isUsingCustomRawKeyedState, numEventTimeTimers, numProcessingTimeTimers, prepareSnapshotPreBarrier, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processWatermark1, processWatermark2, reportOrForwardLatencyMarker, setChainingStrategy, setCurrentKey, setKeyContextElement1, setKeyContextElement2, setProcessingTimeService, snapshotStateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprocessLatencyMarkerclose, dispose, getMetricGroup, getOperatorID, initializeState, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotStatenotifyCheckpointAborted, notifyCheckpointCompletegetCurrentKey, setCurrentKeypublic AsyncWaitOperator(@Nonnull AsyncFunction<IN,OUT> asyncFunction, long timeout, int capacity, @Nonnull AsyncDataStream.OutputMode outputMode, @Nonnull ProcessingTimeService processingTimeService, @Nonnull MailboxExecutor mailboxExecutor)
public void setup(StreamTask<?,?> containingTask, StreamConfig config, Output<StreamRecord<OUT>> output)
SetupableStreamOperatorsetup 在接口中 SetupableStreamOperator<OUT>setup 在类中 AbstractUdfStreamOperator<OUT,AsyncFunction<IN,OUT>>public void open()
throws Exception
AbstractStreamOperatorThe default implementation does nothing.
open 在接口中 StreamOperator<OUT>open 在类中 AbstractUdfStreamOperator<OUT,AsyncFunction<IN,OUT>>Exception - An exception in this method causes the operator to fail.public void processElement(StreamRecord<IN> element) throws Exception
OneInputStreamOperatorprocessElement 在接口中 OneInputStreamOperator<IN,OUT>Exceptionpublic void processWatermark(Watermark mark) throws Exception
OneInputStreamOperatorWatermark. This method is guaranteed to not be called concurrently with
other methods of the operator.processWatermark 在接口中 OneInputStreamOperator<IN,OUT>processWatermark 在类中 AbstractStreamOperator<OUT>ExceptionWatermarkpublic void snapshotState(org.apache.flink.runtime.state.StateSnapshotContext context)
throws Exception
AbstractStreamOperatorsnapshotState 在接口中 StreamOperatorStateHandler.CheckpointedStreamOperatorsnapshotState 在类中 AbstractUdfStreamOperator<OUT,AsyncFunction<IN,OUT>>context - context that provides information and means required for taking a snapshotExceptionpublic void initializeState(org.apache.flink.runtime.state.StateInitializationContext context)
throws Exception
AbstractStreamOperatorinitializeState 在接口中 StreamOperatorStateHandler.CheckpointedStreamOperatorinitializeState 在类中 AbstractUdfStreamOperator<OUT,AsyncFunction<IN,OUT>>context - context that allows to register different states.Exceptionpublic void endInput()
throws Exception
BoundedOneInputendInput 在接口中 BoundedOneInputExceptionCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.