[rules-users] timer and duration

OlliSee o.roess at seeburger.de
Thu Dec 9 07:30:09 EST 2010


Hello there.

I seem to have trouble with the "timer" operator which is documented to have
superseded the "duration" operator for use in the rule body. I might have
something to do with the "not" operator I use in my rule.

Scenario: A is a fact, B is an event

When I write something like this

rule "test"
     timer(int: 5s 5s)
     when
          $a : A()
          not (exists B(a == $a))
     then
          insert(new B($a));         // which means in the new B object: B.a
= $a
end

I expect this rule to fire every 5 seconds if and only if the LHS is true.

I just insert a few A objects at the beginning.
So I expect this rule to fire ONCE, because it will insert the B event which
makes this rule's LHS evaluate to false in the future.
BUT, reality is, this rule fires every 5 seconds, no matter what.

Using the deprecated duration operator with "duration(5s)" instead of the
timer operator, it works as expected. 

I assume, that timer works differently compared to duration. So I conclude
that duration should coexist. Or am I missing something here on the usage of
the timer operator?

Thanks in advance.
Oliver








-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/timer-and-duration-tp2057403p2057403.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list