cancel
Showing results for 
Search instead for 
Did you mean: 

Transaction Subprocess

workflowuser2
Champ in-the-making
Champ in-the-making
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" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="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.
2 REPLIES 2

workflowuser2
Champ in-the-making
Champ in-the-making
any help is appreciated. thanks.

frederikherema1
Star Contributor
Star Contributor
Could you perhaps attach a simple (maven) project containing a failing unit-test? http://activiti.org/userguide/index.html#apiUnitTesting