Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flink Flink处理过程时间或事件时间内的记录_Apache Flink_Flink Streaming - Fatal编程技术网

Apache flink Flink处理过程时间或事件时间内的记录

Apache flink Flink处理过程时间或事件时间内的记录,apache-flink,flink-streaming,Apache Flink,Flink Streaming,我有以下代码: stream1 .connect(stream2) .flatMap(new MyRichCoFlatMapFunction()) .assignTimestampsAndWatermarks( WatermarkStrategy .<Item>forBoundedOutOfOrderness(Duration.ofSeconds(5))

我有以下代码:

stream1
.connect(stream2)
.flatMap(new MyRichCoFlatMapFunction())
.assignTimestampsAndWatermarks(
                        WatermarkStrategy
                        .<Item>forBoundedOutOfOrderness(Duration.ofSeconds(5))
                        .withTimestampAssigner((event, timestamp) -> event.getTimestamp())
                )
.keyBy(item -> item.getKey()).window(new MyWindowAssigner())
.trigger(MyEventTimeTrigger())
.process(new MyProcessWindowFunction());
但是,在我的触发器中,我看到两个函数都有断点

onProcessingTime() is being called

有时


onEventTime()


原因是什么?

原因是,当您将
EventTime
设置为时间特征时,Flink仍然会触发处理时间触发器,触发处理时间计时器,并且通常允许您在多个位置仍然使用
ProcessingTime

这是正确的,并且在特定情况下可能非常方便,例如,如果您的输入源出现问题,并且它不产生任何输入,您仍然可以使用
ProcessingTime
触发器作为安全开关来关闭挂起的窗口

请注意,如果您的代码编写正确,这不会导致任何问题


onEventTime()