public class SensorsAggregates
extends java.lang.Object
System.out
.
The two sensors are read as independent streams but combined
into a single stream and then aggregated across the last 50 readings
using windows. The window is partitioned by the sensor name
so that each sensor will have its own independent window.
This partitioning is automatic so that the same code would
work if readings from one hundred different sensors were
on the same stream, is it just driven by a key function.
The windows are then aggregated using Apache Common Math
provided statistics and the final stream filtered so
that it will only contain values when each sensor
is (independently) out of range.
Constructor and Description |
---|
SensorsAggregates() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
Run a topology with two bursty sensors printing them to standard out.
|
static TStream<com.google.gson.JsonObject> |
sensorsAB(Topology topology)
Create a stream containing two aggregates from two bursty
sensors A and B that only produces output when the sensors
(independently) are having a burst period out of their normal range.
|
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- command argumentsjava.lang.Exception
- on failurepublic static TStream<com.google.gson.JsonObject> sensorsAB(Topology topology)
topology
- Topology to add the sub-graph to.Copyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641