Class WaterMarkEventGenerator<T>

  • All Implemented Interfaces:
    java.lang.Runnable

    public class WaterMarkEventGenerator<T>
    extends java.lang.Object
    implements java.lang.Runnable
    Tracks tuples across input topics and periodically emits watermark events. Watermark event timestamp is the minimum of the latest tuple timestamps across all the input topics (minus the lag). Once a watermark event is emitted any tuple coming with an earlier timestamp can be considered as late events.
    • Constructor Summary

      Constructors 
      Constructor Description
      WaterMarkEventGenerator​(WindowManager<T> windowManager, long intervalMs, long eventTsLagMs, java.util.Set<java.lang.String> inputTopics, org.apache.pulsar.functions.api.Context context)
      Creates a new WatermarkEventGenerator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void run()  
      void shutdown()  
      void start()  
      boolean track​(java.lang.String inputTopic, long ts)
      Tracks the timestamp of the event from a topic, returns true if the event can be considered for processing or false if its a late event.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WaterMarkEventGenerator

        public WaterMarkEventGenerator​(WindowManager<T> windowManager,
                                       long intervalMs,
                                       long eventTsLagMs,
                                       java.util.Set<java.lang.String> inputTopics,
                                       org.apache.pulsar.functions.api.Context context)
        Creates a new WatermarkEventGenerator.
        Parameters:
        windowManager - The window manager this generator will submit watermark events to
        intervalMs - The generator will check if it should generate a watermark event with this intervalMs
        eventTsLagMs - The max allowed lag behind the last watermark event before an event is considered late
        inputTopics - The input topics this generator is expected to handle
    • Method Detail

      • track

        public boolean track​(java.lang.String inputTopic,
                             long ts)
        Tracks the timestamp of the event from a topic, returns true if the event can be considered for processing or false if its a late event.
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • start

        public void start()
      • shutdown

        public void shutdown()