AnsweredAssumed Answered

another async continuation issue

Question asked by workflowuser2 on Aug 9, 2012
I am struggling with understanding even simple async continuation cases.

In the attached process, I have a subprocess and within it I have a service task + a call-activiti. The called-activiti is isSequential="false" and has two steps each a service task. The first service task has async="true"

I am looping the call-activiti multiple times.
However, I see that all iterations of call-activiti is happening sequentially (same thread).

I also noticed that if I remove service task in the subprocess (Service Task1), the behavior is fine (all instances of call-activiti run in separate threads)

Any help will be greatly appreciated.

pdt

main-process:
<?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="MultiInstance" name="process1">
    <startEvent id="startevent1" name="Start"></startEvent>
    <endEvent id="successEndEvent" name="End"></endEvent>
    <subProcess id="subprocess1" name="Sub Process">
      <callActivity id="callactivity1" name="Call activity" calledElement="sampleCallActiviti">
        <extensionElements>
          <activiti:in source="assignee" target="assignee"></activiti:in>
        </extensionElements>
        <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="listObj" activiti:elementVariable="assignee"></multiInstanceLoopCharacteristics>
      </callActivity>
      <startEvent id="startevent2" name="Start"></startEvent>
      <endEvent id="endevent1" name="End"></endEvent>
      <serviceTask id="servicetask2" name="Service Task1" activiti:class="com.activiti.acme.delegates.ADelegate"></serviceTask>
      <sequenceFlow id="flow6" name="" sourceRef="callactivity1" targetRef="endevent1"></sequenceFlow>
      <sequenceFlow id="flow8" name="" sourceRef="startevent2" targetRef="servicetask2"></sequenceFlow>
      <sequenceFlow id="flow9" name="" sourceRef="servicetask2" targetRef="callactivity1"></sequenceFlow>
    </subProcess>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="subprocess1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="subprocess1" targetRef="successEndEvent"></sequenceFlow>
  </process>
</definitions>


Subprocess:
<?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="sampleCallActiviti" name="process1">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="callactiviti task1" activiti:async="true" activiti:class="com.activiti.acme.delegates.Handler1"></serviceTask>
    <serviceTask id="servicetask2" name="call activiti task2" activiti:async="true" activiti:class="com.activiti.acme.delegates.Handler2"></serviceTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow2" name="" sourceRef="servicetask1" targetRef="servicetask2"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="servicetask2" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
  </process>
</definitions>

Outcomes