[rules-users] how to access process variables within wait statenode timers?

Kris Verlaenen kris.verlaenen at cs.kuleuven.be
Mon Jul 26 11:02:07 EDT 2010


Reto,

I think this is because you don't notify the engine when the DroolsTimer 
object has been changed (using update).  You should always notify the engine 
of any state changes (using update(..) if your rules depend on this state). 
Otherwise the engine will assume the state is still the same and won't 
re-evaluate the rules.

Kris

----- Original Message ----- 
From: "retoy" <reto.lamprecht at allianz-suisse.ch>
To: <rules-users at lists.jboss.org>
Sent: Monday, July 26, 2010 2:26 PM
Subject: Re: [rules-users] how to access process variables within wait 
statenode timers?


>
> Kris,
>
> Thanks a lot!
>
> It's true that I do have access to process variables if I assign them
> already when I'm starting the process (passing the value as a parameter of
> the startProcess() method).
> In my first code sample above, I assigned the timer variable only in an
> OnEntry action of the wait state node, which had no effect... (Maybe this 
> is
> only true for version 5.0 (?))
>
> But anyway my timer with a variable delay still doesn't work as I 
> expected:
> The process stays in the wait state until my application terminates,
> although the constraint condition is met after 3 seconds (I print it out
> each time the timer fires). So it looks as if the constraint condition is
> not continuously evaluated... although I'm calling
> context.getProcessInstance().getWorkingMemory().fireAllRules() after every
> update... do you see a reason for that in this updated small code sample?
>
> http://drools-java-rules-engine.46999.n3.nabble.com/file/n996108/demo.variableTimer.v2.zip
> demo.variableTimer.v2.zip
>
> It's interesting that if I don't insert the timer variable into the 
> working
> memory, the timer even continues firing after my application terminated
> (since the constraint is never true and the process stays in the wait
> state)... So inserting it does have some kind of effect on the evaluation 
> of
> the constraint, simply not immediately.
>
>
> Reto
>
> -- 
> View this message in context: 
> http://drools-java-rules-engine.46999.n3.nabble.com/how-to-access-process-variables-within-wait-state-node-timers-tp987504p996108.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 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the rules-users mailing list