Class UserScore

  • Direct Known Subclasses:
    HourlyTeamScore

    public class UserScore
    extends java.lang.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 text files, writing output to text files, using standalone DoFns, use of the sum per key transform, and use 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, 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.

    • Constructor Summary

      Constructors 
      Constructor Description
      UserScore()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method 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.
      • 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

      • configureOutput

        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. This map is passed to the WriteToText constructor to write user score sums.
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Run a batch pipeline.
        Throws:
        java.lang.Exception