Search code examples
javaapache-kafkaapache-kafka-streams

kafka streams windowing and records timestamp


I'am new in kafka streams and i have some unclear points that is why i need help to know how things work:

1. when i define a customTimeExtractor in kafkastreams, does kafka reorder records in an intermediate topic according to the timestamp that i defined?

2. for TumblingWindow for example how does it work with the new timestamp that i have defined? window will start when it detect the first timestamp of the record?

Thank's!


Solution

  • when i define a customTimeExtractor in kafkastreams, does kafka reorder records in an intermediate topic according to the timestamp that i defined?

    No. Records are still processed in offset order, independent of the records embedded timestamp, or whatever other timestamp your custom extractor might return.

    for TumblingWindow for example how does it work with the new timestamp that i have defined? window will start when it detect the first timestamp of the record?

    Basically yes. For each processed input record, we check if there is already an open window. If yes, the record is added to this window. If no, a new window is created.