2016-10-06 31 views
0

我打算使用谷歌的数据流,以协调人在半实物形式完成,3种形式已经完成后的冲突检测。我已经安装谷歌PubSub的两个数据流源和宿,并希望只是有触发火灾后已收到上JobId三种形式发送到PubSub的水槽。elementCountAtLeast之前谷歌的数据流触发器触发达到

This SO post看起来类似于我试图解决这个问题,但是当我实现它,扳机发射,并达到AfterPane.elementCountAtLeast之前发送输出到PubSub的水槽。

我已经与GlobalWindowSlidingWindow试过了它。一旦我得到的触发因素elementCountAtLeast火灾后到达,我打算为jobId实施GroupByKey。但是,在我转移到这一步之前,我想让elementCountAtLeast独立工作。

这里是从PubSub的阅读和代码SlidingWindow:被触发

PCollection<String> humanInTheLoopInput; 
humanInTheLoopInput = pipeline 
    .apply(PubsubIO.Read 
      .named("ReadFromHumanInTheLoopSubscription") 
      .subscription(options.getInputHumanInTheLoopRawSubscription())); 

PCollection<String> windowedInput = humanInTheLoopInput 
    .apply(Window 
      .<String>into(SlidingWindows 
         .of(Duration.standardSeconds(30)) 
         .every(Duration.standardSeconds(5))) 
      .<String>triggering(Repeatedly.forever(AfterPane.elementCountAtLeast(3))) 
      .discardingFiredPanes() 
      .withAllowedLateness(Duration.standardDays(10))); 

回答

2

没有一个GroupByKey什么。窗口和触发只影响分组(和组合)操作。