樊晋龙
10/24/2023, 4:01 PMMarco Villalobos
10/24/2023, 5:12 PMMarco Villalobos
10/24/2023, 5:42 PM樊晋龙
10/25/2023, 3:22 AMfinal SingleOutputStreamOperator<SameBean> b = a
.filter(e->"b".equals(e.getType()));
final SingleOutputStreamOperator<SameBean> c = a
.filter(e->"c".equals(e.getType()));
'b' and 'c' have different timestamp delay, I want make b's window OutOfOrderness longer than a . then I do :
b.assignTimestampsAndWatermarks(WatermarkStrategy.<SameBean>forBoundedOutOfOrderness(Duration.ofSeconds(120)).withTimestampAssigner((event, timestamp)->event.getTimeStamp()).withIdleness(Duration.ofSeconds(10)))
.keyBy(input -> (input.getKey()))
.window(TumblingEventTimeWindows.of(Time.seconds(interval)))
.aggregate(new TagAggAggregator());
c.assignTimestampsAndWatermarks(WatermarkStrategy.<SameBean>forBoundedOutOfOrderness(Duration.ofSeconds(30)).withTimestampAssigner((event, timestamp)->event.getTimeStamp()).withIdleness(Duration.ofSeconds(10)))
.keyBy(input -> (input.getKey()))
.window(TumblingEventTimeWindows.of(Time.seconds(interval)))
.aggregate(new TagAggAggregator());
The only difference is the forBoundedOutOfOrderness(Duration.ofSeconds(30/120)) .
I have some test, after add withIdleness, the wartermark is working.
or is there any other better practice for this situation?Marco Villalobos
10/25/2023, 4:43 AM樊晋龙
10/25/2023, 6:20 AM