3 Replies Latest reply on Jul 25, 2005 10:03 AM by rorysteele

    Dynamic sub-processes



      In jbpm2 you could use a ProcessInvocationHandler to return a ProcessInstance to run during some parent process - allowing some dynamic/configurable behaviour. In jbpm3, the process state uses a sub-process element that only allows you to specify a name and a version.

      The version 2 behaviour was great as I could use a generic defintion (that contains multiple states and transitions between them) and instantiate a sub process within it based on variables passed into this generic definition - in version 3 would need a new definition for each possible embedded sub-process.

      I could achieve the same behaviour in version 3 by programmatically creating a new process instance in an ActionHandler of a normal state, but it all needs extra plumbing to signal on the state when the sub-process completes, when the parent token is cancelled, etc.....

      What would be the best way of adding version 2-like behaviour within the context of the current ProcessState node? Are there any plan to introduce similar behaviour in a later version?

      Regards Rory

        • 1. Re: Dynamic sub-processes
          Ronald van Kuijk Master

          Sounds like some nice functionality failed to make it form 2 to 3. I'd also like this functionality (afaik, some other commercial vendors brag about having this functionality)

          Could you make a jira enhancement request for and post the link to it here?

          • 3. Re: Dynamic sub-processes


            I have tweaked my code in org.jbpm.graph.node.ProcessState (and its associated ProcessState.hbm.xml) to have a processInstantiator Action field - which is used to create instances of ProcessDefinitionInstantiator objects. I have also changed my schema so that process-state elements in the xml have a choice between sub-process and process-config elements (that takes an action element)

            public interface ProcessDefinitionInstantiator {
            public ProcessDefinition createDefinition(ExecutionContext context);

            During execution, in the execute(ExecutionContext executionContext) method, if an instantiator exists, it creates the new ProcessDefinition via the action and its delegated ProcessDefinitionInstantiator.

            How do I go about checking code (with its associated tests of cource :) in?

            Also, the ProcessState object has no specific write method for it's xml - so the sub-process never gets written out - about to register this as a bug