Hello, Yes, this is correct. There is a difference between what we call “stream time” and regular “wall-clock time”.
All the windowing operations need to be deterministic, otherwise your results would depend on when you run your program. For that reason, we have “stream time”, which takes its clock from the incoming records’ timestamps instead of the system clock. Stopping the producer means you also stop sending new record timestamps, and you have effectively paused the clock. As a consequence, the open windows can’t close (nor can other temporal operations continue). If you’re trying to write a test, my suggestion is to send a dummy record (to each partition) with a much later timestamp, which will cause stream time to advance, close out all your windows, and flush your results to the outputs. Now that you know the terminology, you’ll be able to find documentation and presentations online about “stream time”. It’s a confusing but important aspect of stream processing. I hope this helps! -John On Thu, Jul 28, 2022, at 06:19, 张家帅 wrote: > Dear kafka mangers: > when I use kafka stream Tumbling Window, i found that if the > producer send messages to source topic continuously, the stream > TimeWindow could work as expected. but once i stop the producer, the > last window couldn't close, until the producer send next message. Is > this normally? > my code is in the attachment. > Pease anser me when you have time, thanks a lot. > > Attachments: > * KafkaStreamTests.java