-
public class StreamEventAggregationPolicy.Companion
-
-
Field Summary
Fields Modifier and Type Field Description private final IntegerDEFAULT_AGGREGATION_THRESHOLDprivate final LongDEFAULT_MAX_WINDOW_MSprivate final IntegerDEFAULT_DISPATCH_QUEUE_CAPACITYpublic final static StreamEventAggregationPolicy.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final <T extends Any> StreamEventAggregationPolicy<T>from(Function1<String, String> typeExtractor, Function1<String, Result<T>> deserializer, Integer aggregationThreshold, Long maxWindowMs, Integer dispatchQueueCapacity)Creates a validated policy from the given parameters. final IntegergetDEFAULT_AGGREGATION_THRESHOLD()Default aggregation threshold: 50 events trigger aggregated delivery. final LonggetDEFAULT_MAX_WINDOW_MS()Default aggregation max window: 500ms latency ceiling. final IntegergetDEFAULT_DISPATCH_QUEUE_CAPACITY()Default dispatch queue capacity: 16 items. -
-
Method Detail
-
from
final <T extends Any> StreamEventAggregationPolicy<T> from(Function1<String, String> typeExtractor, Function1<String, Result<T>> deserializer, Integer aggregationThreshold, Long maxWindowMs, Integer dispatchQueueCapacity)
Creates a validated policy from the given parameters.
val policy = StreamEventAggregationPolicy.from( typeExtractor = { raw -> eventParser.peekType(raw) }, deserializer = { raw -> eventParser.deserialize(raw) }, aggregationThreshold = 100, maxWindowMs = 300, )- Parameters:
typeExtractor- Extracts the event type from a raw message.deserializer- Deserializes a raw message intoT.aggregationThreshold- Events before aggregated delivery triggers.maxWindowMs- Maximum collection window in milliseconds.dispatchQueueCapacity- Dispatch queue capacity.
-
getDEFAULT_AGGREGATION_THRESHOLD
final Integer getDEFAULT_AGGREGATION_THRESHOLD()
Default aggregation threshold: 50 events trigger aggregated delivery.
-
getDEFAULT_MAX_WINDOW_MS
final Long getDEFAULT_MAX_WINDOW_MS()
Default aggregation max window: 500ms latency ceiling.
-
getDEFAULT_DISPATCH_QUEUE_CAPACITY
final Integer getDEFAULT_DISPATCH_QUEUE_CAPACITY()
Default dispatch queue capacity: 16 items.
-
-
-
-