问题
I have the following piece of code to aggregate data hourly based on event time
KStream<Windowed<String>, SomeUserDefinedClass> windowedResults = inputStream
.groupByKey(Grouped.with(Serdes.String(), new SomeUserDefinedSerde<>()))
.windowedBy(TimeWindows.of(Duration.ofMinutes(60)).grace(Duration.ofMinutes(15)))
.aggregate
(
// do some aggregation
)
.suppress(Suppressed.untilTimeLimit(Duration.ofMinutes(75), Suppressed.BufferConfig.unbounded()))
.toStream();
The issue is that I am unable to close the time window and emit the results if I don't receive data with the same key and a timestamp later than the time limit + grace period.
I would like to know what are the alternatives I can use to ensure the window is closed and data is emitted once a given time has passed (without waiting for any new data for the same key).
Is there an option/feature to make the untilTimeLimit parameter based on real time, and not the event time?
Note: This question is not about why a TimeWindow is not closed, but how to close it in the absence of new data
来源:https://stackoverflow.com/questions/54890239/kafka-streams-suppress-closing-a-timewindow-by-timeout