Logical Sequence
The sequence can repetitively match event sequences and use logical event ordering (using and, or, and not).
Refer the Siddhi query guide for more information.
define stream TempSensorStream(deviceID long,
isActive bool);
define stream HumidSensorStream(deviceID long,
isActive bool);
define stream RegulatorStream(deviceID long, isOn bool);
@sink(type='log')
define stream StateNotificationStream (deviceID long,
tempSensorActive bool, humidSensorActive bool);
from every e1=RegulatorStream[isOn == true],
e2=TempSensorStream and e3=HumidSensorStream
select e1.deviceID, e2.isActive as tempSensorActive,
e3.isActive as humidSensorActive
insert into StateNotificationStream;
|
Defines |
|
Defines |
|
Defines |
|
|
|
Defines |
|
Identifies a regulator activation event immediately followed by both temperature sensor and humidity sensor activation events in either order. |
This application can be used identify a regulator activation event immediately followed by both temperature sensor and humidity sensor activation events in either order.
Input
First, below event is sent to
RegulatorStream
,[
2134
,true
]Then, below event is sent to
HumidSensorStream
,[
124
,true
]Then, below event is sent to
TempSensorStream
,[
242
,false
]
Output
After processing the above input events, the event arriving at StateNotificationStream
will be as follows:
[2134
, false
, true
]