You can set up a periodic timer to update a Tick( currentTime ) and use this Tick fact in your rule:
rule "Set Tick"
timer(int:0s 1s)
when
$tick : Tick()
then
modify( $tick ){ setCurrentTime( ... ) }
end
rule "tst"
when
$ongoing: IntervalEvent( id == "foo", $s: msecstart, $d : msecdur ) )
Tick( currentTime >= $s && <= ($s+$d) )
then
...
end
Dear all,
I am wondering whether and how the rule activation might be contextualized
in respect to the existence of a time slot signalled via interval events (with a
non-null duration). The static rule attributes (date-effective, date-expires) are
not applicable here, neither is the temporal operator "during", which requires
the existence of an explicit second event. The following approach demonstrates the
case but does not work (return value restrictions are not allowed to invoke time-
dependent functions):
rule "active time slot"
when
// partial condition met when there is a "live"/ongoing IntervalEvent "foo"
$system : System()
$ongoing: IntervalEvent( id == "foo", $system.currentTimeMillis <= ( msecstart + msecdur ) )
... further patterns
then
...
end
Many thanks for your suggestions!
Jaro
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users