我使用谷歌云PubSub和数据流来处理我的数据。我想要检测我的日常流程何时完成,换句话说,当窗口会话完成/间隔持续时间达到时。对于这种情况,有没有一个可以触发的触发器?如果没有,有没有我可以使用的变通方法?
Pipeline p = Pipeline.create(options);
p.apply("ReadPubSubMessage", PubsubIO.readMessages().fromSubscription("projects/project-id/subscriptions/my-sub"))
.apply("ApplyTimestamps", WithTimestamps.of((PubsubMessage pubSub) -> new Instant(System.currentTimeMillis())))
.apply("SessionWindowing", Window.<PubsubMessage>into(Sessions.withGapDuration(Duration.standardMinutes(10)))
.triggering(?)
.withAllowedLateness(Duration.standardSeconds(30))
.discardingFiredPanes())
.apply(new CountWords())如果我在文档中遗漏了一些明显的东西,我很抱歉。
发布于 2018-08-29 00:03:21
如果我正确理解了您的场景,您的窗口将在达到间隔持续时间时结束(根据sessions definition)。正因为如此,你可以使用Default Trigger,因为你有有边界的窗口,它只会触发一次。这有意义吗?
您可以在此处找到DefaultTrigger official documentation。
https://stackoverflow.com/questions/52052994
复制相似问题