Hi
Thanks again for the pointers!!
I modified the code but the sliding window rule does not seem to be working as how I want it to be(copied shown in the following). I injected 6 events, one event every 10 seconds, the first one is less than 90, the rest are more than 90. I am expecting getting 3 alerts at 4th event, 5th event and 6 event. But instead I only get one alert.
when
not Reading( reading <= 90 ) over window:time( 30s ) from entry-point ReadingStream
then
System.out.print ("alert: Reading high for 30 seconds \n");
So I used the other way as you suggested. It works and gives me 3 alerts. However if I added the accumulate pattern (copied below) , no alert is generated at all. If I removed the first 3 patterns, just leave the last pattern, it does print the average of last 30 seconds event every time when a new event is injected. What else did I do wrong?
when
$r1: Reading( reading >90 ) from entry-point HeartrateStream
$r2: Reading( reading > 90, this after[30s,30s] $r1 ) from entry-point HeartrateStream
not (Reading( reading <= 90, this after $r1, this before $r2 ) from entry-point HeartrateStream)
$averg: Number() from accumulate( Reading ( $r:reading) over windiw:time(30s) from entry-point HeartrateStream, average($r) )
then
System.out.print ("alert: Reading high for 30 seconds, average reading"+$averg+"\n");
Thanks a lot!!!
Lin