JBoss Community

Re: A question about rule task in jBPM5

created by Esteban Aliverti in jBPM - View the full discussion

Using fireUntilHalt() is not recomended nowadays becasue it causes a bunch of problems like race conditions, rollbacks in TX and even loose of controll of your execution (you don't know in which thread is your process instance running!).

A better approach is to use an invocation pattern as the following one:

 

Each time you want to interact with a process, you need to execute these steps:

  • get the session using JPAKnowledgeService (if you have different threads accessing the same session, it is recomended to queue all the access)
  • invoque the desidered action: startProcess(), signalEvent(), completeWorkItem(), etc.
  • invoque fireAllRules() this invocation is only useful if your process instances reached a Rule Node. If that is not the case, this invocation does nothing, so it is safe to execute it.
  • dispose your session.

 

As far as I know, jBPM5 team and community are working in a more elegant solution that will encapsulate the call of fireAllRules() and make it transparent for the API user.

 

Best Regards

Reply to this message by going to Community

Start a new discussion in jBPM at Community