public class TrafficMaxLaneFlow
extends java.lang.Object
Concepts: The batch and streaming runners, sliding windows, use of the AvroCoder to encode a custom class, and custom Combine transforms.
This example analyzes traffic sensor data using SlidingWindows. For each window, it finds the lane that had the highest flow recorded, for each sensor station. It writes those max values along with auxiliary info 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.
| Modifier and Type | Class and Description |
|---|---|
static class |
TrafficMaxLaneFlow.MaxFlow
A custom 'combine function' used with the Combine.perKey transform.
|
static interface |
TrafficMaxLaneFlow.TrafficMaxLaneFlowOptions
Options supported by
TrafficMaxLaneFlow. |
| Constructor and Description |
|---|
TrafficMaxLaneFlow() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(java.lang.String[] args)
Sets up and starts streaming pipeline.
|
static void |
runTrafficMaxLaneFlow(TrafficMaxLaneFlow.TrafficMaxLaneFlowOptions options) |
public static void runTrafficMaxLaneFlow(TrafficMaxLaneFlow.TrafficMaxLaneFlowOptions options) throws java.io.IOException
java.io.IOExceptionpublic static void main(java.lang.String[] args)
throws java.io.IOException
java.io.IOException - if there is a problem setting up resources