/** * Aligns the time to be the smallest multiple of {@code period} greater than the epoch boundary * (aka {@code new Instant(0)}). */ public AfterProcessingTime alignedTo(final Duration period) { return alignedTo(period, new Instant(0)); }
@Override public PCollection<String> expand(PCollection<KV<String, Integer>> input) { return input .apply(Window.<KV<String, Integer>>into(FixedWindows.of(TWO_MINUTES)) .triggering(Repeatedly.forever(AfterProcessingTime .pastFirstElementInPane() .alignedTo(TWO_MINUTES, Utils.parseTime("12:05:00")))) .withAllowedLateness(Duration.standardDays(1000)) .accumulatingFiredPanes()) .apply(Sum.integersPerKey()) .apply(ParDo.of(new FormatAsStrings())); }
case ALIGN_TO: trigger = trigger.alignedTo( Duration.millis(transform.getAlignTo().getPeriod()), new Instant(transform.getAlignTo().getOffset()));
toProtoAndBackSpec( AfterProcessingTime.pastFirstElementInPane() .alignedTo(Duration.millis(5), new Instant(27))), toProtoAndBackSpec( AfterProcessingTime.pastFirstElementInPane() .plusDelayOf(Duration.standardSeconds(3)) .alignedTo(Duration.millis(5), new Instant(27)) .plusDelayOf(Duration.millis(13))),