[rules-users] counter in slidingTime window with restriction
Wolfgang Laun
wolfgang.laun at gmail.com
Thu Sep 5 06:02:59 EDT 2013
Hard to believe, but who knows.
Drools version and session setup, please.
-W
On 05/09/2013, Alexander Wolf <mail at alexander-wolf.net> wrote:
> 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
>
More information about the rules-users
mailing list