Skip to content

Instantly share code, notes, and snippets.

@enothereska
Created April 30, 2017 09:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enothereska/edb5d6ee83312fef42b8886cc2b97cb2 to your computer and use it in GitHub Desktop.
Save enothereska/edb5d6ee83312fef42b8886cc2b97cb2 to your computer and use it in GitHub Desktop.
A Dataflow example with triggers and watermarks
PCollection<KV<String, Integer>> scores = input
.apply(Window.into(FixedWindows.of(Duration.standardMinutes(2)))
.triggering(
AtWatermark()
.withEarlyFirings(AtPeriod(Duration.standardMinutes(1)))
.withLateFirings(AtCount(1)))
.accumulatingAndRetractingFiredPanes())
.apply(Sum.integersPerKey())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment