Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Handle Different Timezone in Kafka Streams?

So I was evaluating the Kafka Streams and what it can do to see if it can fit my use case as I needed to do the aggregation of sensor's data for each 15min, Hourly, Daily and found it useful due to its Windowing feature. As I can create windows by applying windowedBy() on KGroupedStream but the problem is that windows are created in UTC and i want my data to be grouped by its originating timezone not by UTC Timezone as it hampers the aggregation so can any one help me on this.

like image 238
Hemant Sangle Avatar asked Nov 20 '25 02:11

Hemant Sangle


1 Answers

You can "shift" the timestamps using a custom TimestampExtractor -- before you write the result back into the output topic, you can use a Transformer and "shift" the timestamps back via context.forward(key, value, To.all().withTimestamps()).

Feature request ticket: https://issues.apache.org/jira/browse/KAFKA-7911

like image 80
Matthias J. Sax Avatar answered Nov 21 '25 18:11

Matthias J. Sax



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!