[rules-users] The update function inside a rule

Marc Strabin marc.strabin at gmail.com
Tue Mar 29 05:06:56 EDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110329/7fd512fa/attachment.html 


More information about the rules-users mailing list