I've started to work with Drools Fusion and faced strange issue with during temporal operator. For a reason I cannot make it too work though for example after operator is working fine.
Here is declaration of my event - it just contains an intervals of particular type:
declare WorkingDayInterval @role(event) @timestamp(event_ts_local) @duration(duration_in_seconds) end
Here is my rule:
rule "Idles in Processing period" when $processing : WorkingDayInterval( subcategory == "processing") $longIdle : WorkingDayInterval(this during $processing, subcategory == "idle",duration_in_seconds > 600) then System.out.println ("Bad Idle Event:"); System.out.println ($processing.event_ts_local); System.out.println ($processing.duration_in_seconds); System.out.println ($longIdle.event_ts_local); System.out.println ($longIdle.duration_in_seconds); end
When I run it nothing is fired.
However when I change during to after I get following results:
Bad Idle Event: Mon Feb 25 05:19:00 MSK 2013 2350 Mon Feb 25 05:20:00 MSK 2013 901
and looking at the values I clearly see that based on start timestamps and durations second event is inside the first event and so duration should have been fired.
Is it a bug in the Drools Fusion or I am doing something wrong?
BTW - I am running in a Cloud mode
I think the problem is that you are assuming that @duration
is measured in seconds when in reality Fusion expects it to be expressed in milliseconds. So, in your case, $processing
event starts at 05:19:00.00
and ends at 05:19:02.35
and $longIdle
starts at 05:20:00.00
and ends at 05:20:00.90
. As you can see, $longIdle during $processing
is false but $longIdle after $processing
is true.
Hope it helps,