Java – How are different time zones in Kafka streams handled?

How are different time zones in Kafka streams handled?… here is a solution to the problem.

How are different time zones in Kafka streams handled?

So I’m evaluating Kafka Streams and what it can do to see if it fits my use case because I need to aggregate sensor data every 15 minutes, hourly, daily and find it useful because of its window feature.
Because I can create a window by applying windowedBy() on KGroupedStream, but the problem is that the window is created in UTC, I want my data to be in its original time zone and not by UTC time zone because it hinders aggregation, so can anyone help me with this.

Solution

You can use

custom TimestampExtractor to “move” timestamps — you can use Transformer and “move” via context.forward(key, value, To.all().withTimestamps()) before writing the results back to the output topic Returns a timestamp.

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

Related Problems and Solutions