I am using Kafka Stream windowing aggregation in my ongoin project. I need to clear out how windowing works in Kafka Stream.
This is my question
Does windowed aggregation wait until the grace period for the window is closed before emitting the aggregated result to downstream? or
Does it emit results to downstream when it identifies the record which belongs to the next time window?
This is the sample code I have used streamWindow is 1 s with 1 min grace period
KStream<K, List<V>> aggregatedDataStream = consumedDataStream
.groupByKey(Grouped.with(keySerde, valueSerde))
.windowedBy(streamWindow)
.aggregate(ArrayList::new,
(key, value, aggregate) -> {
aggregate.add(value);
return aggregate;
}, Materialized.with(keySerde, groupedResultSerde))
.toStream();
KStream<K, <List<V>> resultStream = aggregatedDataStream.mapValues(new CommonValueMapper<>(processName, service));