[rules-users] temporal operator workaround

Tobias Salzbrunn tobias.salzbrunn at web.de
Fri Aug 27 05:03:32 EDT 2010


Hi,
I want to fomulate in the LHS something like:
after an event happened another event of this kind did not happen for a
specified time (somewhere externally defined).

Unfortunatly, the obvious solution with the temporal operator 'after':

---------------------------------------------------------------------
rule "rule temporal 1" ruleflow-group "g1"
when
    $event : TestEvent($id: id)
    not( TestEvent(eval($id != id), this after[0ms,5000ms]  $event ) )
then
    System.out.println( "Alarm " + $event.getId());
end
---------------------------------------------------------------------

does not work here, because the specified time has to be hardcoded
(
http://drools-java-rules-engine.46999.n3.nabble.com/Using-variables-in-Temporal-Operators-td1170159.html#a1170159
http://drools-java-rules-engine.46999.n3.nabble.com/Using-variables-in-Temporal-Operators-td1170159.html#a1170159
)


Is there a way to work around this limitation in this special case?
I considered a polling approach with timers, but then I dont know how to
stop the timer after firing the rule.


Thanks in advance for your time.

Tobias 
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/temporal-operator-workaround-tp1367613p1367613.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list