[jboss-user] [jBPM] - Re: Difficulties Invoking Rule Task

Esteban Aliverti do-not-reply at jboss.com
Mon Sep 19 11:41:36 EDT 2011

Esteban Aliverti [http://community.jboss.org/people/eaa] created the discussion

"Re: Difficulties Invoking Rule Task"

To view the discussion, visit: http://community.jboss.org/message/627263#627263

The behavior of Rule Task is the one defined by Mauricio. 
You have 2 options: 
1. execute fireAllRules() manually. This could be very tricky because maybe you don't know when or where you need to invoke it
2. have a separate thread running fireUntilHalt() in the ksession. For this, you need to manually start a thread invoking fileUntilRun() in its run() method.

But the question is, why does the first example work but the second doesn't?
And the "problem" is because of the inclusion of an asynchornous node in your process: the Human Task.

So, when you start your process, the execution reaches the Human Task, the task is created in the HT Server and the execution control gets back to your code. At that point you are executing the fireAllRules(). This fireAllRules() is not doing anything because there is nothing to be fired. The Rule Task was never executed yet.
When you complete the HT, the process continues its execution and the Rule Task gets invoked. Here you need to call fireAllRules() to continue with the execution of the process.

Best Regards,

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110919/58f16591/attachment.html 

More information about the jboss-user mailing list