AnsweredAssumed Answered

Error boundary event on CallActiviti - cancel callactiviti

Question asked by workflowuser2 on Aug 7, 2012
Latest reply on Aug 7, 2012 by workflowuser2
I have a main process (see attached MultiInstance-with-error.bpmn20.jpg) that executes a callactivity (see attached sampleCallActiviti-error.bpmn20.jpg) with loop condition.

I have an error boundary event on called-activiti.

<boundaryEvent id="boundaryerror1" cancelActivity="true" attachedToRef="callactivity1">
      <errorEventDefinition></errorEventDefinition>
    </boundaryEvent>

Called-activiti is run 3 times (loop) and has two service tasks. During first run, I am throwing BpmnError in the first service task (ThrowErrorHandler.java).

My understanding is that remaining two iteration of call-activiti should not execute once a boundary event is thrown and received (I have cancelActiviti = ""true"). However, I see that boundary event is thrown and main process's error path is taken while call activiti continue with all remaining iterations.

I observed that if I embedd call-activiti within a subprocess and cancel the subprocess on error boundary event, the call activiti STOPs.

Help 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>
    <serviceTask id="errorTask" name="ErrorTask" activiti:class="com.activiti.acme.delegates.ErrorDelegate"></serviceTask>
    <serviceTask id="servicetask1" name="NextTask" activiti:class="com.activiti.acme.delegates.Main1Delegate"></serviceTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <endEvent id="errorEndEvent" name="End"></endEvent>
   
    <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>
    <boundaryEvent id="boundaryerror1" cancelActivity="true" attachedToRef="callactivity1">
      <errorEventDefinition></errorEventDefinition>
    </boundaryEvent>
    <sequenceFlow id="flow5" name="" sourceRef="boundaryerror1" targetRef="errorTask"></sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="errorTask" targetRef="errorEndEvent"></sequenceFlow>
    <sequenceFlow id="flow7" name="" sourceRef="startevent1" targetRef="callactivity1"></sequenceFlow>
    <sequenceFlow id="flow8" name="" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow9" name="" sourceRef="callactivity1" targetRef="servicetask1"></sequenceFlow>
  </process>
</definitions>

call-activiti:
<?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="Service Task" activiti:async="true" activiti:class="com.activiti.acme.delegates.ThrowErrorHandler"></serviceTask>
    <serviceTask id="servicetask2" name="Service Task" 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