public class UserScore extends 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 using the Dataflow service and static example input data, specify the pipeline configuration like this:
--project=YOUR_PROJECT_ID
--tempLocation=gs://YOUR_TEMP_DIRECTORY
--runner=BlockingDataflowRunner
--dataset=YOUR-DATASET
where the BigQuery dataset you specify must already exist.
Optionally include the --input argument to specify a batch input file.
See the --input default value for example batch data file, or use 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 Map<String,WriteToBigQuery.FieldInfo<KV<String,Integer>>> |
configureBigQueryWrite()
Create a map of information that describes how to write pipeline output to BigQuery.
|
static void |
main(String[] args)
Run a batch pipeline.
|
protected static Map<String,WriteToBigQuery.FieldInfo<KV<String,Integer>>> configureBigQueryWrite()
WriteToBigQuery constructor to write user score sums.Copyright © 2016 The Apache Software Foundation. All rights reserved.