Class AsyncWaitOperator<IN,OUT>
- java.lang.Object
-
- org.apache.flink.streaming.api.operators.AbstractStreamOperator<OUT>
-
- org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator<OUT,AsyncFunction<IN,OUT>>
-
- org.apache.flink.streaming.api.operators.async.AsyncWaitOperator<IN,OUT>
-
- Type Parameters:
IN- Input type for the operator.OUT- Output type for the operator.
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.state.CheckpointListener,org.apache.flink.streaming.api.operators.BoundedOneInput,org.apache.flink.streaming.api.operators.Input<IN>,org.apache.flink.streaming.api.operators.KeyContext,org.apache.flink.streaming.api.operators.KeyContextHandler,org.apache.flink.streaming.api.operators.OneInputStreamOperator<IN,OUT>,org.apache.flink.streaming.api.operators.OutputTypeConfigurable<OUT>,org.apache.flink.streaming.api.operators.StreamOperator<OUT>,org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator,org.apache.flink.streaming.api.operators.UserFunctionProvider<AsyncFunction<IN,OUT>>,org.apache.flink.streaming.api.operators.YieldingOperator<OUT>
@Internal public class AsyncWaitOperator<IN,OUT> extends org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator<OUT,AsyncFunction<IN,OUT>> implements org.apache.flink.streaming.api.operators.OneInputStreamOperator<IN,OUT>, org.apache.flink.streaming.api.operators.BoundedOneInput
TheAsyncWaitOperatorallows to asynchronously process incoming stream records. For that the operator creates anResultFuturewhich is passed to anAsyncFunction. 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-flightStreamElementin it's operator state. Upon recovery the recorded set of stream elements is replayed.The operator also support retry on predefined condition and strategy
AsyncRetryStrategy. If given strategy is NO_RETRY_STRATEGY or a custom implementedAsyncRetryPredicatewhich defines empty retry predicate, then no retry will happen, everything keeps the same as theAsyncWaitOperatorwithout retry support.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
AsyncWaitOperatorstarts already emitting recoveredStreamElementto downstream operators.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AsyncWaitOperator(org.apache.flink.streaming.api.operators.StreamOperatorParameters<OUT> parameters, AsyncFunction<IN,OUT> asyncFunction, long timeout, int capacity, AsyncDataStream.OutputMode outputMode, AsyncRetryStrategy<OUT> asyncRetryStrategy, org.apache.flink.streaming.runtime.tasks.ProcessingTimeService processingTimeService, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendInput()voidinitializeState(org.apache.flink.runtime.state.StateInitializationContext context)voidopen()voidprocessElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IN> record)voidprocessWatermark(org.apache.flink.streaming.api.watermark.Watermark mark)protected voidsetup(org.apache.flink.streaming.runtime.tasks.StreamTask<?,?> containingTask, org.apache.flink.streaming.api.graph.StreamConfig config, org.apache.flink.streaming.api.operators.Output<org.apache.flink.streaming.runtime.streamrecord.StreamRecord<OUT>> output)voidsnapshotState(org.apache.flink.runtime.state.StateSnapshotContext context)-
Methods inherited from class org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator
close, finish, getUserFunction, getUserFunctionParameters, notifyCheckpointAborted, notifyCheckpointComplete, setOutputType
-
Methods inherited from class org.apache.flink.streaming.api.operators.AbstractStreamOperator
beforeInitializeStateHandler, getContainingTask, getCurrentKey, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getStateKeySelector1, getStateKeySelector2, getTimeServiceManager, getUserCodeClassloader, hasKeyContext1, hasKeyContext2, initializeState, isAsyncKeyOrderedProcessingEnabled, isUsingCustomRawKeyedState, prepareSnapshotPreBarrier, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processRecordAttributes, processRecordAttributes1, processRecordAttributes2, processWatermark, processWatermark1, processWatermark1, processWatermark2, processWatermark2, processWatermarkStatus, processWatermarkStatus, processWatermarkStatus1, processWatermarkStatus2, reportOrForwardLatencyMarker, setCurrentKey, setKeyContextElement1, setKeyContextElement2, setMailboxExecutor, setProcessingTimeService, snapshotState, useInterruptibleTimers
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.state.CheckpointListener
notifyCheckpointAborted, notifyCheckpointComplete
-
Methods inherited from interface org.apache.flink.streaming.api.operators.Input
processLatencyMarker, processRecordAttributes, processWatermark, processWatermarkStatus
-
Methods inherited from interface org.apache.flink.streaming.api.operators.KeyContext
getCurrentKey, setCurrentKey
-
Methods inherited from interface org.apache.flink.streaming.api.operators.KeyContextHandler
hasKeyContext
-
-
-
-
Constructor Detail
-
AsyncWaitOperator
public AsyncWaitOperator(org.apache.flink.streaming.api.operators.StreamOperatorParameters<OUT> parameters, @Nonnull AsyncFunction<IN,OUT> asyncFunction, long timeout, int capacity, @Nonnull AsyncDataStream.OutputMode outputMode, @Nonnull AsyncRetryStrategy<OUT> asyncRetryStrategy, @Nonnull org.apache.flink.streaming.runtime.tasks.ProcessingTimeService processingTimeService, @Nonnull org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor)
-
-
Method Detail
-
setup
protected void setup(org.apache.flink.streaming.runtime.tasks.StreamTask<?,?> containingTask, org.apache.flink.streaming.api.graph.StreamConfig config, org.apache.flink.streaming.api.operators.Output<org.apache.flink.streaming.runtime.streamrecord.StreamRecord<OUT>> output)- Overrides:
setupin classorg.apache.flink.streaming.api.operators.AbstractUdfStreamOperator<OUT,AsyncFunction<IN,OUT>>
-
open
public void open() throws Exception
-
processElement
public void processElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IN> record) throws Exception
-
processWatermark
public void processWatermark(org.apache.flink.streaming.api.watermark.Watermark mark) throws Exception
-
snapshotState
public void snapshotState(org.apache.flink.runtime.state.StateSnapshotContext context) throws Exception- Specified by:
snapshotStatein interfaceorg.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator- Overrides:
snapshotStatein classorg.apache.flink.streaming.api.operators.AbstractUdfStreamOperator<OUT,AsyncFunction<IN,OUT>>- Throws:
Exception
-
initializeState
public void initializeState(org.apache.flink.runtime.state.StateInitializationContext context) throws Exception- Specified by:
initializeStatein interfaceorg.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator- Overrides:
initializeStatein classorg.apache.flink.streaming.api.operators.AbstractUdfStreamOperator<OUT,AsyncFunction<IN,OUT>>- Throws:
Exception
-
-