Window Final Result

I am trying to solve an issue maybe best solved with a database, but i wanted to see if it was posible to solve using streaming
I get power consumption (IOT) readings every 2 second to my kafka topic.
My goal is to agregate the readings (for each iot device) but i have to agregate for each our.
E.g all events from 11:00-11:59:59 and then from 12:00 -12:59:59
I also would like the “result” for the agregation to be stored somewhere (Ktable?)
is that even posible with streaming?

Yes, you can do a windowed aggregation using a tumbling time window.

KStream input =;
KTable result = input
    .groupByKey() // or groupBy(...)

Thanks… I will definitly try this out :smiley:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.