[rules-users] temporal operator workaround

Wolfgang Laun wolfgang.laun at gmail.com
Fri Aug 27 05:35:42 EDT 2010


You can create another event, in parallel to the TestEvent to be monitored, with
a timestamp derived from the external definition. The rule uses the TestEvent
and the sentinel event to check, with "after'" for the TestEvent and "before"
with the sentinel.

-W

On 27 August 2010 11:03, Tobias Salzbrunn <tobias.salzbrunn at web.de> wrote:
>
> 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.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list