2
votes

I'm looking for clear documentation and/or and example on how to setup a time-based trigger on a global window in Apache beam.

The purpose is to perform a count of the events since the last trigger fired, even when 0 events have been added since.

1

1 Answers

2
votes

You can use timers and state, if you need to use global window and emit result even if there was no event since the last firing. I think it is not possible to do it with the built in triggers.

You can keep the count in a state and use a timer to emit the results periodically. These two blog post explains the usage of timers and state:

Stateful processing with Apache Beam

Timely (and Stateful) Processing with Apache Beam