Skip to main content
Version: Current

Aggregate Session

Mode: Streaming

Description​

note

This page describes the behavior specific to aggregations in the session window. For concepts and configuration common to all time-window aggregations, see Aggregations in time windows.

A session window groups events that belong to one continuous period of activity. Unlike sliding and tumbling windows, a session window does not have a fixed length.

A separate session is maintained for each Group by value.

A session closes when either:

  • End session condition evaluates to true for an event; the condition may look at the session's aggregate as #current, or
  • the time since the last event for that Group by value exceeds Session timeout.
Session window concept

For simplicity, all events share the same Group by value ("purple")

 

The computed aggregations can be emitted:

  • On each event - enrich the incoming event with the current aggregate. No additional aggregate event is emitted when the session ends.
  • After session end - incoming events do not continue downstream; when the session closes, a new aggregate event is emitted. Variables belonging to the original events, such as #input and #inputMeta, are therefore unavailable downstream.

Parameters and configuration​

Parameters common to all windows are described here.

ParameterDescription
End session conditionExpression evaluated for each incoming event after the event is aggregated. When it evaluates to true, the current session closes. #current holds the session's aggregate including the event, with the type of the output variable, e.g. with the aggregator #AGG.map({count: #AGG.countWhen}) the condition #current.count >= 10 closes the session on its tenth event. #current is in scope only here. Set it to false if sessions should close only because of inactivity. A false or null result or a failed evaluation keeps the session open, and a failure is reported as an error.
Session timeoutAmount of inactivity after which a session closes. The inactivity period is measured separately for each Group by value.
Emit whenDetermines whether incoming events are enriched while the session is active or a new aggregate event is emitted after the session closes.