AnsweredAssumed Answered

Multiinstance on callactivity

Question asked by workflowuser on Oct 19, 2011
Latest reply on Feb 5, 2013 by araghuraman
Hi,

I am trying multi-instance on call activiti and am not able to understand the result. Help appreciated:
I am using ACT-126 code base.

mainwf.bpmn20.xml
==============
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="MyInstance1" name="MyInstance1">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="Service Task A" activiti:class="com.activiti.tasks.ADelegate"></serviceTask>
    <serviceTask id="servicetask2" name="Service Task B" activiti:class="com.activiti.tasks.BDelegate"></serviceTask>
    <callActivity id="callactivity1" name="Call activity" calledElement="CallAct1" activiti:async="true">
      <multiInstanceLoopCharacteristics isSequential="false">
        <loopCardinality>4</loopCardinality>
      </multiInstanceLoopCharacteristics>
    </callActivity>
    <serviceTask id="servicetask3" name="Service Task C" activiti:class="com.activiti.tasks.CDelegate"></serviceTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="servicetask1" targetRef="servicetask2"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="servicetask2" targetRef="callactivity1"></sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="callactivity1" targetRef="servicetask3"></sequenceFlow>
    <sequenceFlow id="flow5" name="" sourceRef="servicetask3" targetRef="endevent1"></sequenceFlow>
  </process>
 
</definitions>

CallAct1.bpmn20.xml:
================
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="CallAct1" name="CallAct1">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="Service Task X" activiti:class="com.activiti.tasks.XDelegate"></serviceTask>
    <serviceTask id="servicetask2" name="Service Task Y" activiti:class="com.activiti.tasks.YDelegate"></serviceTask>
    <serviceTask id="servicetask3" name="Service Task Z" activiti:class="com.activiti.tasks.ZDelegate"></serviceTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="servicetask1" targetRef="servicetask2"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="servicetask2" targetRef="servicetask3"></sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="servicetask3" targetRef="endevent1"></sequenceFlow>
  </process> 
</definitions>

I expect callactivity1 4 instances to be picked up concurrently. The execution, however, is happening sequentially (main thread executes both main and call activiti instances).

thanks

Outcomes