public class UserScore
extends java.lang.Object
In this gaming scenario, many users play, as members of different teams, over the course of a day, and their actions are logged for processing. Some of the logged game events may be late- arriving, if users play on mobile devices and go transiently offline for a period.
This pipeline does batch processing of data collected from gaming events. It calculates the sum of scores per user, over an entire batch of gaming data (collected, say, for each day). The batch processing will not include any late data that arrives after the day's cutoff point.
To execute this pipeline, specify the pipeline configuration like this:
--tempLocation=YOUR_TEMP_DIRECTORY
--runner=YOUR_RUNNER
--output=YOUR_OUTPUT_DIRECTORY
(possibly options specific to your runner or permissions for your temp/output locations)
Optionally include the --input argument to specify a batch input file. See the --input default
value for example batch data file, or use injector.Injector to generate your own batch
data.
| Modifier and Type | Class and Description |
|---|---|
static class |
UserScore.ExtractAndSumScore
A transform to extract key/score information from GameActionInfo, and sum the scores.
|
static interface |
UserScore.Options
Options supported by
UserScore. |
| Constructor and Description |
|---|
UserScore() |
| Modifier and Type | Method and Description |
|---|---|
protected static java.util.Map<java.lang.String,WriteToText.FieldFn<org.apache.beam.sdk.values.KV<java.lang.String,java.lang.Integer>>> |
configureOutput()
Create a map of information that describes how to write pipeline output to text.
|
static void |
main(java.lang.String[] args)
Run a batch pipeline.
|
protected static java.util.Map<java.lang.String,WriteToText.FieldFn<org.apache.beam.sdk.values.KV<java.lang.String,java.lang.Integer>>> configureOutput()
WriteToText constructor to write user score sums.public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception