AnsweredAssumed Answered

Error boundary event on global scope

Question asked by workflowuser2 on Jul 3, 2012
Latest reply on Jul 6, 2012 by workflowuser2
hi,

I am looking into catching BpmnError from any of the Java Service Tasks in the process.
Currently, I am able to catch error within the "subprocess" scope using the following process definition:

<?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="SubprocessCompensation" name="process1">
    <startEvent id="startevent1" name="Start"></startEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="servicetaskMain1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="servicetaskMain1" targetRef="subProcess"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="subProcess" targetRef="servicetaskMain2"></sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="servicetaskMain2" targetRef="endevent1"></sequenceFlow>
    <serviceTask id="servicetaskMain1" name="Service Task Main1" activiti:async="true" activiti:class="com.acme.delegates.Main1Delegate"></serviceTask>
    <serviceTask id="servicetaskMain2" name="Service Task Main2" activiti:async="true" activiti:class="com.acme.delegates.Main2Delegate"></serviceTask>
   
    <transaction id="myTransaction">
    <subProcess id="subProcess">
      <startEvent id="subProcessStart" />
      <sequenceFlow id="flow12" sourceRef="subProcessStart" targetRef="servicetask1" />
      <sequenceFlow id="flow13" sourceRef="servicetask1" targetRef="servicetask2" />
      <sequenceFlow id="flow17" sourceRef="servicetask2" targetRef="throwCompensation" />
      <sequenceFlow id="flow18" sourceRef="throwCompensation" targetRef="subProcessEnd" />
      <serviceTask id="servicetask1" name="Service Task 1" activiti:async="true" activiti:class="com.acme.delegates.Sub1Delegate"></serviceTask>
      <serviceTask id="undoTask1" isForCompensation="true" activiti:async="true" activiti:class="com.acme.delegates.UndoSub1Delegate" />
      <serviceTask id="servicetask2" name="Service Task2" activiti:async="true" activiti:class="com.acme.delegates.Sub2Delegate"></serviceTask>
      <serviceTask id="undoTask2" isForCompensation="true" activiti:async="true" activiti:class="com.acme.delegates.UndoSub2Delegate" />
      <endEvent id="subProcessEnd" />
      <boundaryEvent id="compensateTask1Evt" attachedToRef="servicetask1" >      
          <compensateEventDefinition />
      </boundaryEvent>
      <boundaryEvent id="compensateTask2Evt" attachedToRef="servicetask2" >      
          <compensateEventDefinition />
      </boundaryEvent>
      <intermediateThrowEvent id="throwCompensation">
        <compensateEventDefinition/>
      </intermediateThrowEvent>
      <association associationDirection="One" id="a1"  sourceRef="compensateTask1Evt" targetRef="undoTask1" />
      <association associationDirection="One" id="a2"  sourceRef="compensateTask2Evt" targetRef="undoTask2" />
    </subProcess>
    </transaction>
   
    <serviceTask id="servicetaskError1" name="Service Task Error1" activiti:async="true" activiti:class="com.acme.delegates.Main1Delegate"></serviceTask>
    <endEvent id="errorEnd" />
    <sequenceFlow id="flow_error1" sourceRef="boundaryerror1" targetRef="servicetaskError1" />
    <sequenceFlow id="flow_error2" sourceRef="servicetaskError1" targetRef="errorEnd" />
   
     <boundaryEvent id="boundaryerror1" attachedToRef="subProcess">
      <errorEventDefinition/>
   </boundaryEvent>
  </process>
</definitions>


How can I catch boundary event on the global scope (main process)?
     <boundaryEvent id="boundaryerror1" attachedToRef="???">
      <errorEventDefinition/>
   </boundaryEvent>


Thanks

Outcomes