【发布时间】:2019-06-18 06:39:48
【问题描述】:
我正在从数据流管道中的 PubSub 主题读取记录。 PubSub 记录分为固定窗口,然后在每个窗口上分组。每个窗口都按序列号排序,因为我们需要使用 beam.SortValues 按顺序处理这些记录。然后我将记录写入 Cloud BigTable
管道的问题是数据新鲜度和系统滞后。数据新鲜度似乎卡在某个点,水印停止前进。
我正在使用以下窗口策略在 GroupByKey 步骤之后发出记录:
PCollection<KV<BigInteger, JSONObject>> window = pubsubRecords.apply("Raw to String", ParDo.of(new LogsFn()))
.apply("Window", Window
.<KV<BigInteger, JSONObject>>into(FixedWindows.of(Duration.standardSeconds(10)))
.triggering(Repeatedly.forever(AfterFirst.of(
AfterPane.elementCountAtLeast(500),
AfterProcessingTime.pastFirstElementInPane().plusDelayOf(Duration.standardMinutes(1)))))
.withAllowedLateness(Duration.ZERO).discardingFiredPanes()
);
我认为问题可能出在窗口策略上。基本上我想做以下事情:从 PubSub 读取记录到 1 分钟的 FixedWindows,对窗口进行排序并写入 BigTable。如果我使用默认触发器,则 GroupByKey 步骤不会发出任何结果。有人可以帮我解决这个问题吗?
【问题讨论】:
标签: java streaming google-cloud-dataflow apache-beam