Interface WatermarkStrategyWithPeriodicWatermarks<T>

  • Type Parameters:
    T - The type of the elements to which this assigner assigns timestamps.
    All Superinterfaces:
    Serializable, org.apache.flink.api.common.eventtime.TimestampAssigner<T>, org.apache.flink.api.common.eventtime.TimestampAssignerSupplier<T>, org.apache.flink.api.common.eventtime.WatermarkGeneratorSupplier<T>, org.apache.flink.api.common.eventtime.WatermarkStrategy<T>

    @Internal
    public interface WatermarkStrategyWithPeriodicWatermarks<T>
    extends org.apache.flink.api.common.eventtime.WatermarkStrategy<T>, org.apache.flink.api.common.eventtime.TimestampAssigner<T>
    The WatermarkStrategyWithPeriodicWatermarks assigns event time timestamps to elements, and generates low watermarks that signal event time progress within the stream. These timestamps and watermarks are used by functions and operators that operate on event time, for example event time windows.

    Use this class to generate watermarks in a periodical interval. At most every i milliseconds (configured via ExecutionConfig.getAutoWatermarkInterval()), the system will call the getCurrentWatermark() method to probe for the next watermark value. The system will generate a new watermark, if the probed value is non-null and has a timestamp larger than that of the previous watermark (to preserve the contract of ascending watermarks).

    The system may call the getCurrentWatermark() method less often than every i milliseconds, if no new elements arrived since the last call to the method.

    Timestamps and watermarks are defined as longs that represent the milliseconds since the Epoch (midnight, January 1, 1970 UTC). A watermark with a certain value t indicates that no elements with event timestamps x, where x is lower or equal to t, will occur any more.

    See Also:
    Watermark
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.flink.api.common.eventtime.TimestampAssignerSupplier

        org.apache.flink.api.common.eventtime.TimestampAssignerSupplier.Context, org.apache.flink.api.common.eventtime.TimestampAssignerSupplier.SupplierFromSerializableTimestampAssigner<T extends Object>
      • Nested classes/interfaces inherited from interface org.apache.flink.api.common.eventtime.WatermarkGeneratorSupplier

        org.apache.flink.api.common.eventtime.WatermarkGeneratorSupplier.Context
    • Field Summary

      • Fields inherited from interface org.apache.flink.api.common.eventtime.TimestampAssigner

        NO_TIMESTAMP
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default org.apache.flink.api.common.eventtime.TimestampAssigner<T> createTimestampAssigner​(org.apache.flink.api.common.eventtime.TimestampAssignerSupplier.Context context)  
      default org.apache.flink.api.common.eventtime.WatermarkGenerator<T> createWatermarkGenerator​(org.apache.flink.api.common.eventtime.WatermarkGeneratorSupplier.Context context)  
      Watermark getCurrentWatermark()
      Returns the current watermark.
      • Methods inherited from interface org.apache.flink.api.common.eventtime.TimestampAssigner

        extractTimestamp
      • Methods inherited from interface org.apache.flink.api.common.eventtime.WatermarkStrategy

        getAlignmentParameters, withIdleness, withTimestampAssigner, withTimestampAssigner, withWatermarkAlignment, withWatermarkAlignment
    • Method Detail

      • getCurrentWatermark

        @Nullable
        Watermark getCurrentWatermark()
        Returns the current watermark. This method is periodically called by the system to retrieve the current watermark. The method may return null to indicate that no new Watermark is available.

        The returned watermark will be emitted only if it is non-null and its timestamp is larger than that of the previously emitted watermark (to preserve the contract of ascending watermarks). If the current watermark is still identical to the previous one, no progress in event time has happened since the previous call to this method. If a null value is returned, or the timestamp of the returned watermark is smaller than that of the last emitted one, then no new watermark will be generated.

        The interval in which this method is called and Watermarks are generated depends on ExecutionConfig.getAutoWatermarkInterval().

        Returns:
        Null, if no watermark should be emitted, or the next watermark to emit.
        See Also:
        Watermark, ExecutionConfig.getAutoWatermarkInterval()
      • createTimestampAssigner

        default org.apache.flink.api.common.eventtime.TimestampAssigner<T> createTimestampAssigner​(org.apache.flink.api.common.eventtime.TimestampAssignerSupplier.Context context)
        Specified by:
        createTimestampAssigner in interface org.apache.flink.api.common.eventtime.TimestampAssignerSupplier<T>
        Specified by:
        createTimestampAssigner in interface org.apache.flink.api.common.eventtime.WatermarkStrategy<T>
      • createWatermarkGenerator

        default org.apache.flink.api.common.eventtime.WatermarkGenerator<T> createWatermarkGenerator​(org.apache.flink.api.common.eventtime.WatermarkGeneratorSupplier.Context context)
        Specified by:
        createWatermarkGenerator in interface org.apache.flink.api.common.eventtime.WatermarkGeneratorSupplier<T>
        Specified by:
        createWatermarkGenerator in interface org.apache.flink.api.common.eventtime.WatermarkStrategy<T>