Kafka Stream daily aggregation

Viewed 36

Given I have the following AVRO schema or object format

consumption {
   consumptionId;
   consumptionTime;
   region;
   amount;
}

I would like to aggregate by consumptionId and sum the totalAmount for each consumptionId for a given window. The given window is [endOfDay-24h, endOfDay] and the endOfDay is different for each region.

  • for region: USA, NYC, the endOfDay is 18:00
  • for region: UK, London,the endOfDay is 20:00

Currently I am playing with it, but I am not really happy with the outcome. Can anyone suggest a good approach?

Do I need to create a stream for each region(endOfDay)? I'm at the beginning of my Kafka-streams journey and I would be really grateful if someone could help me :)

0 Answers
Related