3

我正在使用 Apache Beam 从 Kafka 阅读。由于对 Kafka 的无序写入,我想使用有效负载中的事件时间戳而不是默认的 LogAppendTime。

我在 Apache Beam 中看到了一个解决方案:Error assignmenting event time using Withtimestamp

我们如何定义水印?考虑到它应该是单调的。

在方法中

getWatermark(TimestampPolicy.PartitionContext ctx)

当发生迟到数小时的事件时,我们如何确定水印。

这似乎是乱序写入和事件时间窗口的一个非常常见的场景。我没有看到太多关于如何做到这一点的文献。

4

1 回答 1

1

您可以使用https://beam.apache.org/documentation/programming-guide/#adding-timestamps-to-a-pcollections-elementsParDo从数据中提取时间戳outputWithTimestamp

于 2019-09-10T11:38:31.487 回答