Class AbstractInput<IN,OUT>
- java.lang.Object
-
- org.apache.flink.streaming.api.operators.AbstractInput<IN,OUT>
-
- All Implemented Interfaces:
Input<IN>
,KeyContextHandler
,AsyncStateProcessing
@Experimental public abstract class AbstractInput<IN,OUT> extends Object implements Input<IN>, KeyContextHandler, AsyncStateProcessing
Base abstract implementation ofInput
interface intended to be used when extendingAbstractStreamOperatorV2
.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
inputId
protected Output<StreamRecord<OUT>>
output
protected AbstractStreamOperatorV2<OUT>
owner
protected KeySelector<?,?>
stateKeySelector
KeySelector
for extracting a key from an element being processed.
-
Constructor Summary
Constructors Constructor Description AbstractInput(AbstractStreamOperatorV2<OUT> owner, int inputId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThrowingConsumer<StreamRecord<IN>,Exception>
getRecordProcessor(int inputId)
Get the record processor that could process record from input, which is the only entry for async processing.boolean
hasKeyContext()
Whether theInput
has "KeyContext".boolean
isAsyncStateProcessingEnabled()
Get if the async state processing is enabled for this input/operator.void
processLatencyMarker(LatencyMarker latencyMarker)
Processes aLatencyMarker
that arrived on the first input of this two-input operator.void
processRecordAttributes(RecordAttributes recordAttributes)
Processes aRecordAttributes
that arrived at this input.void
processWatermark(Watermark mark)
Processes aWatermark
that arrived on the first input of this two-input operator.void
processWatermarkStatus(WatermarkStatus watermarkStatus)
Processes aWatermarkStatus
that arrived on this input of theMultipleInputStreamOperator
.void
setKeyContextElement(StreamRecord record)
Set the correct key context before processing therecord
.-
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.streaming.api.operators.Input
processElement
-
Methods inherited from interface org.apache.flink.streaming.api.operators.KeyContextHandler
hasKeyContext1, hasKeyContext2
-
-
-
-
Field Detail
-
stateKeySelector
@Nullable protected final KeySelector<?,?> stateKeySelector
KeySelector
for extracting a key from an element being processed. This is used to scope keyed state to a key. This is null if the operator is not a keyed operator.This is for elements from the first input.
-
owner
protected final AbstractStreamOperatorV2<OUT> owner
-
inputId
protected final int inputId
-
output
protected final Output<StreamRecord<OUT>> output
-
-
Constructor Detail
-
AbstractInput
public AbstractInput(AbstractStreamOperatorV2<OUT> owner, int inputId)
-
-
Method Detail
-
processWatermark
public void processWatermark(Watermark mark) throws Exception
Description copied from interface:Input
Processes aWatermark
that arrived on the first input of this two-input operator. This method is guaranteed to not be called concurrently with other methods of the operator.- Specified by:
processWatermark
in interfaceInput<IN>
- Throws:
Exception
- See Also:
Watermark
-
processLatencyMarker
public void processLatencyMarker(LatencyMarker latencyMarker) throws Exception
Description copied from interface:Input
Processes aLatencyMarker
that arrived on the first input of this two-input operator. This method is guaranteed to not be called concurrently with other methods of the operator.- Specified by:
processLatencyMarker
in interfaceInput<IN>
- Throws:
Exception
- See Also:
LatencyMarker
-
processWatermarkStatus
public void processWatermarkStatus(WatermarkStatus watermarkStatus) throws Exception
Description copied from interface:Input
Processes aWatermarkStatus
that arrived on this input of theMultipleInputStreamOperator
. This method is guaranteed to not be called concurrently with other methods of the operator.- Specified by:
processWatermarkStatus
in interfaceInput<IN>
- Throws:
Exception
- See Also:
WatermarkStatus
-
setKeyContextElement
public void setKeyContextElement(StreamRecord record) throws Exception
Description copied from interface:Input
Set the correct key context before processing therecord
. Used for example to extract key from therecord
and pass that key to the state backends. This method is guaranteed to not be called concurrently with other methods of the operator.- Specified by:
setKeyContextElement
in interfaceInput<IN>
- Throws:
Exception
-
processRecordAttributes
public void processRecordAttributes(RecordAttributes recordAttributes) throws Exception
Description copied from interface:Input
Processes aRecordAttributes
that arrived at this input. This method is guaranteed to not be called concurrently with other methods of the operator.- Specified by:
processRecordAttributes
in interfaceInput<IN>
- Throws:
Exception
-
hasKeyContext
public boolean hasKeyContext()
Description copied from interface:KeyContextHandler
Whether theInput
has "KeyContext". If false, we can omit the call ofInput.setKeyContextElement(org.apache.flink.streaming.runtime.streamrecord.StreamRecord<IN>)
for each record.- Specified by:
hasKeyContext
in interfaceKeyContextHandler
- Returns:
- True if the
Input
has "KeyContext", false otherwise.
-
isAsyncStateProcessingEnabled
@Internal public final boolean isAsyncStateProcessingEnabled()
Description copied from interface:AsyncStateProcessing
Get if the async state processing is enabled for this input/operator.- Specified by:
isAsyncStateProcessingEnabled
in interfaceAsyncStateProcessing
- Returns:
- ture if async state processing is enabled.
-
getRecordProcessor
@Internal public final ThrowingConsumer<StreamRecord<IN>,Exception> getRecordProcessor(int inputId)
Description copied from interface:AsyncStateProcessing
Get the record processor that could process record from input, which is the only entry for async processing.- Specified by:
getRecordProcessor
in interfaceAsyncStateProcessing
- Parameters:
inputId
- the input identifier, start from 1. Borrow the design fromorg.apache.flink.streaming.api.operators.AbstractInput#inputId
. This is only relevant if there is multiple inputs for the instance.
-
-