An event grouper is a specialized form of an Event Processor that groups events together by a common field, such as a customer ID, and/or by event timestamps (often called windowing or time-based windowing).
For time-based grouping a.k.a. time-based windowing, we use an Event Processor that groups the related events into windows based on their event timestamps. Most window types have a pre-defined window size, such as 10 minutes or 24 hours. An exception is session windows, where the size of each window varies depending on the time characteristics of the grouped events.
For field-based grouping, we use an Event Processor that groups events by one or more data fields, irrespective of the event timestamps.
The two grouping approaches are orthogonal and can be composed. For example, to compute 7-day averages for every customer in a stream of payments, we first group the events in the stream by customer ID and by 7-day windows, and then compute the respective averages for each customer+window grouping.
As an example, the streaming database ksqlDB provides the capability to group related events by a column and group them into "windows" where all the related events have a timestamp within the defined time-window.
SELECT product-name, COUNT(*), SUM(price) FROM purchases WINDOW TUMBLING (SIZE 1 MINUTE) GROUP BY product-name EMIT CHANGES;
When grouping events into time windows, there are various types of groupings possible.