SlidingWindows defines fixed-duration Kafka Streams windows whose boundaries follow record timestamps. Each incoming record creates a window ending at its timestamp and looks back for records within the configured maximum time difference. section 9.1.4 section 9.1.5
Key implementation behaviors:
- Create the window with SlidingWindows.ofTimeDifferenceWithNoGrace(Duration.ofSeconds(30)). section 9.1.4
- Treat both start and end boundaries as inclusive. section 9.1.4
- Evaluate when records enter or leave the window, rather than continuously like a hopping window. section 9.1.4
Page-view aggregation
A page-view stream can be grouped by key, windowed with a 30-second sliding difference, aggregated with pageViewAggregator, and written to page-view-sliding-aggregates. section 9.1.4
Figure 9.21 Event timestamps determine the start and end of sliding and session windows.
Use the timestamp-alignment diagram to compare sliding windows with session windows and see how event timestamps determine their boundaries. section 9.1.5
