从1.4.2迁移到1.14.2时的Flink接收时间实施

wztqucjr  于 2022-12-09  发布在  Apache
关注(0)|答案(1)|浏览(93)

We have stream processing pipeline to ingest Kafka messages. And we were using Flink v1.4.2. and now planning to migrate to 1.14.2.
Timestamps are based on ingest-time. As env.setStreamTimeCharacteristic(TimeCharacteristic.IngestionTime) is depcreated since 1.12 , how to set this ??
Which watermark strategy should be used ?
timeWinow() is also deprecated. I Couldn't find way to use: window(SlidingIngestionTimeWindows.of()) only SlidingProcessingTimeWindows/SlidingEventTimeWindows available.
Thanks.

km0tfn4u

km0tfn4u1#

What you can do is to use a watermark strategy like this one

WatermarkStrategy<Event> wmStrategy =
    WatermarkStrategy
        .<Event>forMonotonousTimestamps()
        .withTimestampAssigner((event, timestamp) -> System.currentTimeMillis());

in combination with SlidingEventTimeWindows.

相关问题