2016-10-06 26 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什麼。窗口和觸發隻影響分組(和組合)操作。