From the course: Apache Flink: Real-Time Data Engineering
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Using session windows - Flink Tutorial
From the course: Apache Flink: Real-Time Data Engineering
Using session windows
- [Narrator] In this video, I will show you the use of session windows on a partitioned data stream. We continue with the windowing operations class as in the previous video. In this example, we will partition the stream by user. We will create session windows with a gap of five seconds for each user. This means that if a given user does not have an event within five seconds, the current session ends and the next one will start. We start with a map function to create a tuple of the user, a count of one and then minimum and maximum time stamps. We also specify the return types. Then we use a keyBy function to specify that this stream needs to be partitioned by the user column. To create a session window, we will use the window function and specify that we will use a processing time-based session window with a gap of five seconds. Processing time means that the timestamp on the Flink processor, will be used as a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.