com.google.cloud.dataflow.examples.complete.game

## Class UserScore

- java.lang.Object
- - com.google.cloud.dataflow.examples.complete.game.UserScore

Direct Known Subclasses:
  HourlyTeamScore

    public class UserScore
    extends Object

This class is the first in a series of four pipelines that tell a story in a 'gaming' domain. Concepts: batch processing; reading input from Google Cloud Storage and writing output to BigQuery; using standalone DoFns; use of the sum by key transform; examples of Java 8 lambda syntax.

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
       --stagingLocation=gs://YOUR_STAGING_DIRECTORY
       --runner=BlockingDataflowPipelineRunner
       --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.

### Nested Class Summary

Nested Classes
`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 Summary

Constructors
Constructor and Description
`UserScore()`

### Method Summary

All Methods Static Methods Concrete Methods
`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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### UserScore

    public UserScore()

### Method Detail

#### configureBigQueryWrite

    protected static Map<String,WriteToBigQuery.FieldInfo<KV<String,Integer>>> configureBigQueryWrite()

Create a map of information that describes how to write pipeline output to BigQuery. This map is passed to the `WriteToBigQuery` constructor to write user score sums.

#### main

    public static void main(String[] args)
                     throws Exception

Run a batch pipeline.

Throws:
  `Exception`