@Internal public class StatusWatermarkValve extends Object
StatusWatermarkValve
embodies the logic of how Watermark
and StreamStatus
are propagated to downstream outputs, given a set of one or multiple input channels
that continuously receive them. Usages of this class need to define the number of input channels
that the valve needs to handle, as well as provide a implementation of PushingAsyncDataInput.DataOutput
, which
is called by the valve only when it determines a new watermark or stream status can be
propagated.Modifier and Type | Class and Description |
---|---|
protected static class |
StatusWatermarkValve.InputChannelStatus
An
InputChannelStatus keeps track of an input channel's last watermark, stream
status, and whether or not the channel's current watermark is aligned with the overall
watermark output from the valve. |
Constructor and Description |
---|
StatusWatermarkValve(int numInputChannels)
Returns a new
StatusWatermarkValve . |
Modifier and Type | Method and Description |
---|---|
protected StatusWatermarkValve.InputChannelStatus |
getInputChannelStatus(int channelIndex) |
void |
inputStreamStatus(StreamStatus streamStatus,
int channelIndex,
PushingAsyncDataInput.DataOutput<?> output)
Feed a
StreamStatus into the valve. |
void |
inputWatermark(Watermark watermark,
int channelIndex,
PushingAsyncDataInput.DataOutput<?> output)
Feed a
Watermark into the valve. |
public StatusWatermarkValve(int numInputChannels)
StatusWatermarkValve
.numInputChannels
- the number of input channels that this valve will need to handlepublic void inputWatermark(Watermark watermark, int channelIndex, PushingAsyncDataInput.DataOutput<?> output) throws Exception
Watermark
into the valve. If the input triggers the valve to output a new
Watermark, PushingAsyncDataInput.DataOutput.emitWatermark(Watermark)
will be called to process the new
Watermark.watermark
- the watermark to feed to the valvechannelIndex
- the index of the channel that the fed watermark belongs to (index
starting from 0)Exception
public void inputStreamStatus(StreamStatus streamStatus, int channelIndex, PushingAsyncDataInput.DataOutput<?> output) throws Exception
StreamStatus
into the valve. This may trigger the valve to output either a new
Stream Status, for which PushingAsyncDataInput.DataOutput.emitStreamStatus(StreamStatus)
will be called, or
a new Watermark, for which PushingAsyncDataInput.DataOutput.emitWatermark(Watermark)
will be called.streamStatus
- the stream status to feed to the valvechannelIndex
- the index of the channel that the fed stream status belongs to (index
starting from 0)Exception
@VisibleForTesting protected StatusWatermarkValve.InputChannelStatus getInputChannelStatus(int channelIndex)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.