My use case involves my application receiving events, some of which we can expect to arrive out of time order (up to 2 days after the 'event' time) which I need to group by key. I don't want to aggregate the records but simply get an ordered list of those events time window at a time. I doubt using an aggregation function to build a List of events will work as I am very likely to get a RecordTooLargeException as there are likely to be thousands of events per key/time window.
The code I played with creates a Tumbling Window with a 2 day grace period - which works in principle but required me to use an aggregation - and I feel my use case of building a list of messages is going beyond what the aggregate function was originally intended for - e.g.
stream.stream[Key, Entry](inputTopic)(Consumed.`with`[EntryKey, Entry](timestampExtractor))
.groupByKey(Grouped.`with`(keySerde, valueSerde))
.windowedBy(TimeWindows.of(windowSize).grace(windowGrace))
.aggregate[EntryGroup](
EntryGroup(Seq.empty[Entry])
)((_: EntryKey, newValue: Entry, aggregate: EntryGroup) => EntryGroup(aggregate.anprEntries :+ newValue))
.suppress(Suppressed.untilWindowCloses(Suppressed.BufferConfig.unbounded()))
Is there an idiomatic way of passing downstream ordered groups of events for a key/timewindow without running into record size issues?