Search code examples
apache-flink

When does a Flink window get emitted?


"For example, with an event-time-based windowing strategy that creates non-overlapping (or tumbling) windows every 5 minutes and has an allowed lateness of 1 min, Flink will create a new window for the interval between 12:00 and 12:05 when the first element with a timestamp that falls into this interval arrives, and it will remove it when the watermark passes the 12:06 timestamp."

When the watermark passes the 12:06 timestamp -- is that when the window function processes the watermark itself, i.e. when the source watermark passes through the window operator, or when the window operator processes the next record after the watermark?


Solution

  • The time flow in case of event time processing in Flink is always based on Watermarks not the events themselves.

    This means that if You have some window with let's say 10 elements, if You have a watermarking strategy that periodically generates increasing watermarks (say You increase them by few seconds every time), the window will still get closed and emitted at some point even if You never receive any other events.