Package com.hazelcast.jet.core
Interface WatermarkPolicy
public interface WatermarkPolicy
This object tracks and determines the current
Watermark
given the
event timestamps as they occur for a single input stream. Typically the
watermark will be advanced with a fixed lag
behind the top observed timestamp so far.
This object is used by source processors to determine the current watermark. The processor may choose to create several of these objects to track each source partition separately and each processor will also have their own instance. The implementation does not need to be thread-safe.
- Since:
- 3.0
- See Also:
EventTimePolicy
,EventTimeMapper
-
Method Summary
Modifier and Type Method Description long
getCurrentWatermark()
Called to get the current watermark in the absence of an observed event.static SupplierEx<WatermarkPolicy>
limitingLag(long lag)
Maintains a watermark that lags behind the top observed timestamp by the given amount.long
reportEvent(long timestamp)
Called to report the observation of an event with the given timestamp.
-
Method Details
-
reportEvent
long reportEvent(long timestamp)Called to report the observation of an event with the given timestamp. Returns the watermark that should be (or have been) emitted before the event.If the returned value is greater than the event's timestamp it means that the event should be dropped.
- Parameters:
timestamp
- event's timestamp- Returns:
- the watermark value. May be
Long.MIN_VALUE
if there is insufficient information to determine any watermark (e.g., no events observed)
-
getCurrentWatermark
long getCurrentWatermark()Called to get the current watermark in the absence of an observed event. The watermark may advance based just on the passage of time. -
limitingLag
Maintains a watermark that lags behind the top observed timestamp by the given amount.Note: if Jet stops receiving events at some point (e.g., at the end of a business day), the watermark will stop advancing and stay behind the most recent events. Jet will not output the results of aggregating these events until it starts receiving events again (e.g., at the start of the next business day).
- Parameters:
lag
- the desired difference between the top observed timestamp and the watermark
-