Class StatefulTeamScore
- java.lang.Object
-
- org.apache.beam.examples.complete.game.UserScore
-
- org.apache.beam.examples.complete.game.HourlyTeamScore
-
- org.apache.beam.examples.complete.game.LeaderBoard
-
- org.apache.beam.examples.complete.game.StatefulTeamScore
-
public class StatefulTeamScore extends LeaderBoard
This class is part of a series of pipelines that tell a story in a gaming domain. Concepts include: stateful processing.This pipeline processes an unbounded stream of 'game events'. It uses stateful processing to aggregate team scores per team and outputs team name and it's total score every time the team passes a new multiple of a threshold score. For example, multiples of the threshold could be the corresponding scores required to pass each level of the game. By default, this threshold is set to 5000.
Stateful processing allows us to write pipelines that output based on a runtime state (when a team reaches a certain score, in every 100 game events etc) without time triggers. See https://beam.apache.org/blog/2017/02/13/stateful-processing.html for more information on using stateful processing.
Run
injector.Injectorto generate pubsub data for this pipeline. The Injector documentation provides more detail on how to do this.To execute this pipeline, specify the pipeline configuration like this:
--project=YOUR_PROJECT_ID --tempLocation=gs://YOUR_TEMP_DIRECTORY --runner=YOUR_RUNNER --dataset=YOUR-DATASET --topic=projects/YOUR-PROJECT/topics/YOUR-TOPICThe BigQuery dataset you specify must already exist. The PubSub topic you specify should be the same topic to which the Injector is publishing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceStatefulTeamScore.OptionsOptions supported byStatefulTeamScore.static classStatefulTeamScore.UpdateTeamScoreFnTracks each team's score separately in a single state cell and outputs the score every time it passes a new multiple of a threshold.-
Nested classes/interfaces inherited from class org.apache.beam.examples.complete.game.UserScore
UserScore.ExtractAndSumScore
-
-
Constructor Summary
Constructors Constructor Description StatefulTeamScore()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String[] args)-
Methods inherited from class org.apache.beam.examples.complete.game.LeaderBoard
configureBigQueryWrite, configureGlobalWindowBigQueryWrite, configureWindowedTableWrite
-
Methods inherited from class org.apache.beam.examples.complete.game.HourlyTeamScore
configureOutput
-
-