@Internal public class WatermarkOutputMultiplexer extends Object
WatermarkOutputMultiplexer
combines the watermark (and idleness) updates of multiple
partitions/shards/splits into one combined watermark update and forwards it to an underlying
WatermarkOutput
.
A multiplexed output can either be immediate or deferred. Watermark updates on an immediate
output will potentially directly affect the combined watermark state, which will be forwarded to
the underlying output immediately. Watermark updates on a deferred output will only update an
internal state but not directly update the combined watermark state. Only when onPeriodicEmit()
is called will the deferred updates be combined and forwarded to the
underlying output.
For registering a new multiplexed output, you must first call #registerNewOutput(String)
and then call getImmediateOutput(String)
or getDeferredOutput(String)
with the output ID you get from that. You can get both an immediate
and deferred output for a given output ID, you can also call the getters multiple times.
WARNING:This class is not thread safe.
Modifier and Type | Class and Description |
---|---|
static interface |
WatermarkOutputMultiplexer.WatermarkUpdateListener
A callback for propagating changes to split based watermarks.
|
Constructor and Description |
---|
WatermarkOutputMultiplexer(WatermarkOutput underlyingOutput)
Creates a new
WatermarkOutputMultiplexer that emits combined updates to the given
WatermarkOutput . |
Modifier and Type | Method and Description |
---|---|
WatermarkOutput |
getDeferredOutput(String outputId)
Returns a deferred
WatermarkOutput for the given output ID. |
WatermarkOutput |
getImmediateOutput(String outputId)
Returns an immediate
WatermarkOutput for the given output ID. |
void |
onPeriodicEmit()
Tells the
WatermarkOutputMultiplexer to combine all outstanding deferred watermark
updates and possibly emit a new update to the underlying WatermarkOutput . |
void |
registerNewOutput(String id,
WatermarkOutputMultiplexer.WatermarkUpdateListener onWatermarkUpdate)
Registers a new multiplexed output, which creates internal states for that output and returns
an output ID that can be used to get a deferred or immediate
WatermarkOutput for that
output. |
boolean |
unregisterOutput(String id) |
public WatermarkOutputMultiplexer(WatermarkOutput underlyingOutput)
WatermarkOutputMultiplexer
that emits combined updates to the given
WatermarkOutput
.public void registerNewOutput(String id, WatermarkOutputMultiplexer.WatermarkUpdateListener onWatermarkUpdate)
WatermarkOutput
for that
output.public boolean unregisterOutput(String id)
public WatermarkOutput getImmediateOutput(String outputId)
WatermarkOutput
for the given output ID.
>See WatermarkOutputMultiplexer
for a description of immediate and deferred
outputs.
public WatermarkOutput getDeferredOutput(String outputId)
WatermarkOutput
for the given output ID.
>See WatermarkOutputMultiplexer
for a description of immediate and deferred
outputs.
public void onPeriodicEmit()
WatermarkOutputMultiplexer
to combine all outstanding deferred watermark
updates and possibly emit a new update to the underlying WatermarkOutput
.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.