-
public final class StreamAggregatedEvent<T extends Object>A batch of events produced by StreamEventAggregator during a traffic spike.
When the aggregator detects high event throughput, it collects events within a time window and delivers them as a single StreamAggregatedEvent instead of dispatching each individually. This allows product SDKs to apply all updates sequentially in one atomic state update and one UI recomposition per window instead of one per event.
Events are stored in arrival order. Product SDKs should process them sequentially to maintain correctness (e.g. "reaction added" must be processed before "reaction removed" for the same entity).
During normal (low) traffic, events flow through individually — this class is only used during spikes.
when (event) { is StreamAggregatedEvent<*> -> { event.events.forEach { singleEvent -> handleSingleEvent(singleEvent) } } else -> handleSingleEvent(event) }
-
-
Constructor Summary
Constructors Constructor Description StreamAggregatedEvent(List<T> events)
-