Expand description
§Session Window Operators
Implementation of session windows for stream processing.
Session windows are dynamic windows that group events by activity periods separated by gaps. Unlike tumbling and sliding windows which have fixed boundaries, session windows grow with activity and close after inactivity.
§Key Characteristics
- Dynamic boundaries: Sessions start with the first event and extend with each new event within the gap period
- Per-key tracking: Each key maintains independent session state
- Gap-based closure: Sessions close when no events arrive within the gap
- Session merging: Late data can merge previously separate sessions
§Example
Gap: 30 seconds
Events: [t=0] [t=10] [t=20] ...gap... [t=100] [t=110]
|<---- Session 1 ---->| |<- Session 2 ->|
[0, 50) [100, 140)§Usage
use laminar_core::operator::session_window::SessionWindowOperator;
use laminar_core::operator::window::CountAggregator;
use std::time::Duration;
// Create a session window with 30-second gap
let operator = SessionWindowOperator::new(
Duration::from_secs(30), // gap timeout
CountAggregator::new(),
Duration::from_secs(60), // allowed lateness
);Structs§
- Archived
Session Id - An archived
SessionId - Archived
Session Index - An archived
SessionIndex - Archived
Session Metadata - An archived
SessionMetadata - Session
Id - Unique identifier for a session instance.
- Session
IdResolver - The resolver for an archived
SessionId - Session
Index - Index of all active sessions for a single key.
- Session
Index Resolver - The resolver for an archived
SessionIndex - Session
Metadata - Metadata for a single session within a key’s session index.
- Session
Metadata Resolver - The resolver for an archived
SessionMetadata - Session
Metrics - Session metrics for monitoring.
- Session
Window Operator - Creates the standard session output schema. Session window operator.