[jboss-user] [jBPM] - How to start/spawn 'n' subprocesses for 'n' users using JBPM-4.3.

Al Nadein do-not-reply at jboss.com
Wed Jul 21 17:15:35 EDT 2010


Al Nadein [http://community.jboss.org/people/matrixpooh] replied to the discussion

"How to start/spawn 'n' subprocesses for 'n' users using JBPM-4.3."

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

--------------------------------------------------------------
 http://community.jboss.org/people/swiderski.maciej swiderski.maciejMaciej,

Thanks for a prompt reply. I was able to achieve what i wanted.

Here's my sample process:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>

<process key="main" name="main" xmlns=" http://jbpm.org/4.4/jpdl http://jbpm.org/4.4/jpdl">
   
   <start g="-7,25,48,48" name="start">
      <transition g="-28,-16" name="to-open-case" to="Open Case"/>
   </start>
   
   <foreach g="254,18,48,48" in="#{events}" name="foreach" var="event">
      <transition to="Create a sub-process"/>
   </foreach>
   
   <custom g="96,16,126,52" name="Open Process">
      <transition g="-30,-34" name="to-create-subprocesses" to="foreach"/>
   </custom>

   <join g="490,18,48,48" multiplicity="#{quorum}" name="join">
      <transition g="-11,-14" name="to-end" to="end"/>
   </join>

   <end g="570,18,48,48" name="end"/>

   <sub-process g="334,16,124,52" name="Create a sub-process" sub-process-key="#{event}">
      <transition g="-12,-17" name="to-join" to="join"/>
   </sub-process>
     
</process>
{code}

Here's a client:
{code}
        Map<String, Object> variables = new HashMap<String, Object>();

        String[] events = new String[] { "sub1", "sub2", "sub3" };
        variables.put("events", events);
        variables.put("quorum", new Integer(events.length)); // join cardinality
        
        ProcessInstance processInstance = executionService.startProcessInstanceByKey("main", variables, "123");
{code}

The problem is - I don't seem to be able cascade delete after that - weather i start from main or any of its children, i'm falling into integrity constrains. The below fails:
{code}
List<ProcessDefinition> deployments = repositoryService
                .createProcessDefinitionQuery().processDefinitionKey("main").list();
        for (int i = 0; i < deployments.size(); i++) {
            ProcessDefinition pd = deployments.get(i);
            repositoryService.deleteDeploymentCascade(pd.getDeploymentId());
        }
{code}

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/553831#553831]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100721/3c06a5f6/attachment.html 


More information about the jboss-user mailing list