Class TrafficRoutes
- java.lang.Object
-
- org.apache.beam.examples.complete.TrafficRoutes
-
public class TrafficRoutes extends java.lang.ObjectA Beam Example that runs in both batch and streaming modes with traffic sensor data. You can configure the running mode by setting --streaming to true or false.Concepts: The batch and streaming runners, GroupByKey, sliding windows.
This example analyzes traffic sensor data using SlidingWindows. For each window, it calculates the average speed over the window for some small set of predefined 'routes', and looks for 'slowdowns' in those routes. It writes its results to a BigQuery table.
The pipeline reads traffic sensor data from --inputFile.
The example is configured to use the default BigQuery table from the example common package (there are no defaults for a general Beam pipeline). You can override them by using the --bigQueryDataset, and --bigQueryTable options. If the BigQuery table do not exist, the example will try to create them.
The example will try to cancel the pipelines on the signal to terminate the process (CTRL-C) and then exits.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceTrafficRoutes.TrafficRoutesOptionsOptions supported byTrafficRoutes.
-
Constructor Summary
Constructors Constructor Description TrafficRoutes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String[] args)Sets up and starts streaming pipeline.static voidrunTrafficRoutes(TrafficRoutes.TrafficRoutesOptions options)
-
-
-
Method Detail
-
runTrafficRoutes
public static void runTrafficRoutes(TrafficRoutes.TrafficRoutesOptions options) throws java.io.IOException
- Throws:
java.io.IOException
-
main
public static void main(java.lang.String[] args) throws java.io.IOExceptionSets up and starts streaming pipeline.- Throws:
java.io.IOException- if there is a problem setting up resources
-
-