Package 

Class StreamAggregatedEvent


  • 
    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)
    }
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final List<T> events
    • Method Summary

      Modifier and Type Method Description
      final List<T> getEvents()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StreamAggregatedEvent

        StreamAggregatedEvent(List<T> events)