我们可以从历史数据创建 kafka 时间窗口流吗?

Can we create kafka time windowed stream from historical data?

我有一些历史数据,每条记录都有时间戳。我想阅读它们并将它们提供给 kafka 主题,并使用 kafka 流以 windowed 的方式处理它们。

现在的问题是,当我创建 kafka 流时间 windowed 聚合处理器时,我如何告诉 kafka 使用记录中的时间戳字段来创建时间 window,而不是实时的时间?

您需要创建一个看起来相关的自定义 TimestampExtractor that will extract the value from the record itself - there's an example of this in the documentation, and here too. I also found this gist