You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 雷水鱼 <le...@daojia-inc.com> on 2019/06/27 07:13:22 UTC

Flink 窗口触发疑问

 在 WindowOperator 类中
 processElement() 处理每一个到来的元素,我发现这里返回结果是fire的也能够触发窗口计算

TriggerResult triggerResult = triggerContext.onElement(element);
if (triggerResult.isFire()) {
   ACC contents = windowState.get();
   if (contents == null) {
      continue;
   }
   emitWindowContents(window, contents);}

onEventTime() 方法应该是由注册的定时器调用的,也能触发窗口计算

这下我就迷惑了,新来一条数据,达到了触发条件,这个窗口到底是由 processElement() 触发还是由定时器调用onEventTime()  触发的呢?