I think there is an open JIRA for a very similar issue:

JBRULES-2825 "rule with timer and CE not keeps firing after turning false"

I have added these two rules as a comment.

However, the timer isn't necessary in this here case. Since the SimpleClock fact is updated periodically, the engine will fire the rule as soon as dateInMillisec exceeds the clock value in the Message fact.

Both rules work correctly, if written without the timer.

Actuallay, the timer doesn't have any effect (except wasting a few cycles). If the LHS becomes true, it delays the first firing by 1s, and then the LHS is made false by changing the Message object. This stops the timer! But then, eventually, the LHS becomes true again, and another timer is started, delays 1s, fires, and terminates.

-W


2011/3/29 Marc Strabin <marc.strabin@gmail.com>:
> Hello, 
> I've 2 rules which should be similar but the result is different and I can't
> understand why :
> I insert an object Message() into drools with the following rule :
>
> rule "rule_a"
> timer (int:1s 1s) 
> when 
> SimpleClock ( d : dateInMillisec != 0 )  // SimpleClock give the current
> time (set by a java timer and an update)
> m : Message ( internalEndDate < d )
> then 
> System.out.println( "rule a");
> m.setInternalEndDate (d + 10000); 
> retract (m);
> insert (m);
> end
>
>> the result is fine : a message every 10.
> If I replace the rule_a by the rule_b : (because an update should be better
> than an retract/insert I guess)
>
> rule "rule_b"
> timer (int:1s 1s)
> when 
> SimpleClock ( d : dateInMillisec != 0 )  // Simple slock give the current
> time (set by a java timer and an update)
> m : Message ( internalEndDate < d )
> then 
> System.out.println( "rule b");
> m.setInternalEndDate (d + 10000); 
> update (m);
> end
>
>> the result is bad : a message every 1 second. 
> It act as if the attibute message.internalEndDate wasn't updated in the
> drools engine. Could someone explain me if/why this behaviour is normal ?
> Thanks in advance
> Marc
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>