com.hazelcast.jet.core

## Interface WatermarkPolicy

-     public interface WatermarkPolicy

  This object runs inside a Jet processor, inspects the event timestamps as they occur in the input and and decides on the current value of the watermark. It controls how much disorder Jet will allow in a data stream and which events will be marked as "too late" and dropped. It also decides what to do with the watermark when there are no events for a while. If just one of the many processors working in parallel doesn't receive any events, its watermark may fall behind and impede the progress of the entire DAG. The policy may decide to advance the watermark based on the passage of time alone.

  The processor must report to this object the timestamp of every event it receives by calling `reportEvent(long)`. It must also ensure that, even in the absence of events, it keeps checking the `current value` of the watermark. When the watermark advances far enough (as decided by the `WatermarkEmissionPolicy`, if in use), it must emit a watermark item to its output edges.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getCurrentWatermark()` Called to get the current watermark in the absence of an observed event.
    `long` | `reportEvent(long timestamp)` Called to report the observation of an event with the given timestamp.

- - ### Method Detail

    - #### 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.

Copyright © 2018. All rights reserved.