AnsweredAssumed Answered

Transaction Subprocess

Question asked by workflowuser2 on Jun 21, 2012
Latest reply on Jun 22, 2012 by frederikheremans1
Hi,

I am trying the new Transaction Subprocess feature in activiti 5.9.

<?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="flow11" name="" sourceRef="startevent1" targetRef="subProcess"></sequenceFlow>
    <sequenceFlow id="flow12" name="" sourceRef="subProcess" targetRef="throwCompensation"></sequenceFlow>
    <sequenceFlow id="flow13" name="" sourceRef="throwCompensation" targetRef="endevent1"></sequenceFlow>
   
    <transaction id="myTransaction">
    <subProcess id="subProcess">
   
      <startEvent id="subProcessStart" />
      <sequenceFlow id="flow2" sourceRef="subProcessStart" targetRef="servicetask1" />
      <sequenceFlow id="flow3" sourceRef="servicetask1" targetRef="servicetask2" />
      <sequenceFlow id="flow7" sourceRef="servicetask2" targetRef="subProcessEnd" />
      <serviceTask id="servicetask1" name="Service Task 1" activiti:class="com.activiti.dell.delegates.Main1Delegate"></serviceTask>
      <serviceTask id="undoTask1" isForCompensation="true" activiti:class="com.activiti.dell.delegates.UndoMain1Delegate" />
      <serviceTask id="servicetask2" name="Service Task2" activiti:class="com.activiti.dell.delegates.Main2Delegate"></serviceTask>
      <serviceTask id="undoTask2" isForCompensation="true" activiti:class="com.activiti.dell.delegates.UndoMain2Delegate" />
      <endEvent id="subProcessEnd" />
      <boundaryEvent id="compensateTask1Evt" attachedToRef="servicetask1" >      
          <compensateEventDefinition />
      </boundaryEvent>
      <boundaryEvent id="compensateTask2Evt" attachedToRef="servicetask2" >      
          <compensateEventDefinition />
      </boundaryEvent>
      <association associationDirection="One" id="a1"  sourceRef="compensateTask1Evt" targetRef="undoTask1" />
      <association associationDirection="One" id="a2"  sourceRef="compensateTask2Evt" targetRef="undoTask2" />
    </subProcess>
    </transaction>
   
    <intermediateThrowEvent id="throwCompensation">
        <compensateEventDefinition/>
    </intermediateThrowEvent>
   
  </process>
</definitions>

However, compensation (undoTaskx) is not called.
I believe that the problem in signaling compensate intermediate event.
<intermediateThrowEvent id="throwCompensation">
        <compensateEventDefinition/>
    </intermediateThrowEvent>
Could you help me find a way to trigger compensation event from outside the transacted subprocess ?

Thank you in advance.

Outcomes