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

retoy reto.lamprecht at allianz-suisse.ch
Mon Jul 26 08:26:37 EDT 2010


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.



More information about the rules-users mailing list