cancel
Showing results for 
Search instead for 
Did you mean: 

PROCESS_CANCELLED event not sent for parent process when call activiti subprocess encounters terminate all end event

jim1
Champ on-the-rise
Champ on-the-rise
We have a top level process which uses a <callActivity> element to start a subprocess.
One of the routes through the subprocess ends with a terminateAll end event. This is correctly cancelling both the sub process and parent process.

However, we have an ActivitiEventListener which logs each process as it ends, and we're only seeing a PROCESS_CANCELLED event being thrown for the sub process. I'd expect to also see one for the parent process as well.

Is this intended? If so, is there a way that we can detect that the parent process is also being cancelled?

Thanks.
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
Can you post an example xml to clarify? Are we talking about an embedded subprocess or a call activity here?

jim1
Champ on-the-rise
Champ on-the-rise
Hi,
Yes, this is using call activiti.

Example processes:

Parent
<code>
<?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:xsd="http://www.w3.org/2001/XMLSchema" 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" xmlns:inhealth="http://inhealthcare.co.uk/bpmn" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/test">
  <process id="listener-parent-process-v2" name="listener-parent-process-v2" isExecutable="true">
    <startEvent id="sid-33128A96-BB1E-42E0-BCFB-C03F485801E5">
    </startEvent>
    <parallelGateway id="sid-43DDB3E8-5433-4BA7-B733-21826129FCF3"/>
    <sequenceFlow id="sid-C5F548B9-25F7-4171-A60A-C077D4332212" sourceRef="sid-33128A96-BB1E-42E0-BCFB-C03F485801E5" targetRef="sid-43DDB3E8-5433-4BA7-B733-21826129FCF3"/>
    <userTask id="sid-D00EB5FC-A179-424E-B2CC-3BFD89D43439" name="Parent flow task" activiti:async="true" activiti:candidateGroups="USER" activiti:category="CAT1" />
    <callActivity id="listener-sub-process" name="listener-sub-process" activiti:async="true" calledElement="listener-sub-process">
    </callActivity>
    <sequenceFlow id="sid-4ABCD301-736C-4577-B455-75E6537BE2D4" sourceRef="sid-43DDB3E8-5433-4BA7-B733-21826129FCF3" targetRef="listener-sub-process"/>
    <sequenceFlow id="sid-287C9C37-BFA3-47A2-B382-5C16F2A606A0" sourceRef="sid-43DDB3E8-5433-4BA7-B733-21826129FCF3" targetRef="sid-D00EB5FC-A179-424E-B2CC-3BFD89D43439"/>
    <endEvent id="sid-6D84CC2E-0929-4187-866E-2A7FC59786BB"/>
    <sequenceFlow id="sid-93E0256E-F5C7-4D2B-935C-925D5A66BE4C" sourceRef="sid-D00EB5FC-A179-424E-B2CC-3BFD89D43439" targetRef="sid-6D84CC2E-0929-4187-866E-2A7FC59786BB"/>
    <sequenceFlow id="sid-A0861B97-3CBD-4FDF-B4D8-83FA319C0D18" sourceRef="listener-sub-process" targetRef="sid-6D84CC2E-0929-4187-866E-2A7FC59786BB"/>
  </process>
</definitions>
</code>

Subprocess
<code>
<?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:xsd="http://www.w3.org/2001/XMLSchema" 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" xmlns:inhealth="http://inhealthcare.co.uk/bpmn" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/test">
  <process id="listener-sub-process" name="listener-sub-process" isExecutable="true">
    <startEvent id="sid-B2C5FFE3-EDA9-4F5B-AE03-B349637FF7A6">
    </startEvent>
    <userTask id="sid-7165D81A-FCA8-4DA5-9F81-D8D8DE3A0255" name="Sub process task" activiti:async="true" activiti:candidateGroups="USER" activiti:category="CAT1" />
    <endEvent id="sid-D93F8154-7AE8-49F4-BCD6-F67A94A480A3">
      <terminateEventDefinition activiti:terminateAll="true"/>
    </endEvent>
    <sequenceFlow id="sid-13395507-B2B5-4F56-9BA8-71D3CAD98057" sourceRef="sid-B2C5FFE3-EDA9-4F5B-AE03-B349637FF7A6" targetRef="sid-7165D81A-FCA8-4DA5-9F81-D8D8DE3A0255"/>
    <sequenceFlow id="sid-07CAA441-5D91-470A-85EE-69E94B21A571" sourceRef="sid-7165D81A-FCA8-4DA5-9F81-D8D8DE3A0255" targetRef="sid-D93F8154-7AE8-49F4-BCD6-F67A94A480A3"/>
  </process>
</definitions>
</code>

willb
Champ on-the-rise
Champ on-the-rise

Jim _  You're completely right.  I consider this a bug.  See my post... and my own answer / solution to the problem.  Not pretty, bit of a hurdle, but it works.  In our case, we are concerned with boundary events that cancel the Call Activity as well as the parent process being terminated.  Neither of those occurrences fire the PROCESS_CANCELLED listener point.

Activiti