A Flink streaming application for processing temperature data from a Pravega Stream
.
Complements the Turbine Heat Sensor app
(turbineheatsensor
).
The application computes a daily summary of the temperature range observed on that day by each sensor.
Automatically creates a scope (default: examples
) and stream (default: turbineHeatTest
) as necessary.
- Pravega running (see here for instructions)
- Build pravega-samples repository
- Apache Flink 1.12 running
Run the sample from the command-line:
$ bin/run-example [--controller <URI>] [--input <scope>/<stream>] [--startTime <long>] [--output <path>]
Alternately, run the sample from the Flink UI.
- JAR:
pravega-flink-examples-<VERSION>-all.jar
- Main class:
io.pravega.turbineheatprocessor.TurbineHeatProcessor
orio.pravega.turbineheatprocessor.TurbineHeatProcessorScala
The application outputs the daily summary as a comma-separated values (CSV) file, one line per sensor per day. The data is also visable in the Flink UI. For example:
...
SensorAggregate{startTime=28800000, sensorId=2, location='Arizona', tempMin=50.0, tempMax=90.0}
SensorAggregate{startTime=28800000, sensorId=18, location='Maine', tempMin=30.0, tempMax=70.0}
SensorAggregate{startTime=28800000, sensorId=10, location='Hawaii', tempMin=40.0, tempMax=80.0}
SensorAggregate{startTime=28800000, sensorId=3, location='Arkansas', tempMin=60.0, tempMax=100.0}
SensorAggregate{startTime=28800000, sensorId=0, location='Alabama', tempMin=50.0, tempMax=90.0}
SensorAggregate{startTime=28800000, sensorId=17, location='Louisiana', tempMin=70.0, tempMax=110.0}
SensorAggregate{startTime=28800000, sensorId=19, location='Maryland', tempMin=60.0, tempMax=100.0}
...