[rules-users] The update function inside a rule

FrankVhh frank.vanhoenshoven at agserv.eu
Tue Mar 29 06:23:24 EDT 2011


Hi Marc,

Your rules do not immediately reveal anything remarkable to me, so I do not
have an explanation or solution just yet.

Here is what I would do to narrow down on the problem:
Add an output in your rules that print the internal end date and the current
date in each RHS of the rules.

It is unlikely that the WM is not updated at all, that would cause
internalEndDate to remain unchanged and rules wouldn't be fired anymore.

Regards,
Frank


Marc Strabin wrote:
> 
> 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/The-update-function-inside-a-rule-tp2747484p2747740.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list