2 Replies Latest reply on Jun 18, 2012 2:23 AM by martin.landua

    Problem with subprocesses embedded in multi-instance nodes


      Hi all,


      we are struggling with a problem sub processes from within a multi-instance node if the sub processes contain a timer or a signal event, so when the execution flow is interrupted in the sub process. The problem is that the main process fails to continue after the second multi-instance node.


      We would very much appreciate your feedback.


      We are using jBPM version 5.3.0.Final, embedded in JBoss 7.1.1. We have configured persistence against a MySql 5.5 database.


      Despite of the actual implementation of our process the following extracted sample pretty much shows what our problem is.




      After a few days of analysis we feel that following happens:


      • We start the process as usual using startProcess, providing an array with two strings "A" and "B" which in essence launches two sub processes from the multi-instance node.
      • Everything is fine with the first multi-instance node, it creates the sub processes, adds two more rows to processinstanceinfo (in addition to the one of the main process) and adds another two rows to eventtypes with the fixed content "processInstanceCompleted:xxx" where xxx is the process id of the respective sub process.
      • Within the sub processes, the timer event stops the process execution, persisting everything to the database and waits until the timer fires again.
      • Once the timer has fired, the two sub processes are signalled and due to the fact that there is a listener to the "processInstanceCompleted" event in the main process, the main process will get evidence once all sub processes have completed, and can continue to execute.
      • Now the main process again creates two sub processes and again it will register the two "processInstanceCompleted" created by its child sub processes.
      • But - and here is the problem from my point of view - the sub process does not get updated or otherwise persisted once the sub processes run into the timer events.
      • As a result, those "processInstanceCompleted" events will not show up in the database and consequently, the main process will never be informed once the sub processes are terminating.
      • The last step in the process can never be reached.


      From what I understand, the problem can occur ONLY in cases when there is a second sub process/multi-instance component and within the sub process there is a break from a timer node or a signal event node.


      We are launching the main process from a stateless session bean in response to a message grabbed from a JMS-like queuing system. I am pretty sure that we do not have a problem with persistence in general.


      I have attached the skeleton of the project.


      Any comment or idea is highly appreciated.


      Thanks in advance,