In the previous blog, we talked about Flink’s windows operator, a heart of processing infinite streams. Generally in Flink, after specifying that the stream is keyed or non keyed, the next step is to define a window assigner. The window assigner defines how elements are assigned to windows. Flink provides some useful predefined window assigners like Tumbling windowsSliding windowsSession windows, Count windows, and Global windows. We can use any of them as per our use case or even we can create custom window assigners in Flink.

In this blog, we will learn about the first two window assigners i.e., Tumbling and sliding windows. These two window assigners, assign elements to windows based on time, which can either be processing time or event time.

  • Event time refers to the processing of streaming data based on timestamps which are attached to each row. The timestamps can encode and attached to the entity when an event is generated at its source.
  • Processing time refers to the system time of the machine (also known as “wall-clock time”) that is executing the respective operation. This is the time when the actual processing of stream entities is Started.

In this blog, we are going to use processing time for our Flink application. Now let see the tumbling and sliding windows in action.

#apache flink #java #ai

Flink: Time Windows based on Processing Time
1.80 GEEK