Hey guys,
I wrote a rule to count the SensorEvents in my KnowledgeSession that have been inserted
via entry-point SensorEventStream over the last 3 seconds - but I only want the event to
fire, if there were any events in the last 3 seconds at all.
Problem: if there were no recent events, i still get the output:
Events in last 3 seconds: 0
I don't really get why?! This is my rule code:
rule "slidingTimeCount"
when
$n: Number (intValue > 0) from accumulate ( $e: SensorEvent() over window:time(3s)
from entry-point SensorEventStream, count($e))
then
System.out.println("Events in last 3 seconds: " + $n);
end