cancel
Showing results for 
Search instead for 
Did you mean: 

End event triggered on non-canceling boundary timer?

jhahn
Champ in-the-making
Champ in-the-making
If there's a boundary timer with execution listener for event end, is it expected behavior that a non-canceling boundary timer will trigger the event end? So I have a receive task with a non-canceling timer with 30s timer. After 30s, it will execute the

<activiti:executionListener event="end" expression="${execution.setVariable(&quot;test&quot;, true)}"></activiti:executionListener>

Is this expected behavior? I expected it to not trigger since non-canceling timer doesn't really end the receive task?




Also, I'm a little confused on the documentation for execution listener. It says for event="start", it will NOTIFY the execution listener when it starts but only EXECUTE/CALL the notify function when an end event occurs. Then it says the 3rd execution listener (event="end") in that example will be CALLED when it "ends".

http://i.imgur.com/sVihR0B.png

Is notify and call different? If event="start" and event="end" will both only be actually called when end event occurs, what's the difference?




Anyway, here is the test process for the first question.

<?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" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="myProcess" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <receiveTask id="receivetask1" name="Receive Task">
      <extensionElements>
        <activiti:executionListener event="end" expression="${execution.setVariable(&quot;test&quot;, true)}"></activiti:executionListener>
      </extensionElements>
    </receiveTask>
    <boundaryEvent id="boundarytimer1" name="Timer" attachedToRef="receivetask1" cancelActivity="false">
      <timerEventDefinition>
        <timeDuration>PT30S</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <userTask id="usertask1" name="User Task"></userTask>
    <sequenceFlow id="flow1" sourceRef="boundarytimer1" targetRef="usertask1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="startevent1" targetRef="receivetask1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow3" sourceRef="receivetask1" targetRef="endevent1"></sequenceFlow>
  </process>
</definitions>
4 REPLIES 4

trademak
Star Contributor
Star Contributor
Can you share the exact BPMN XML?
When the receive task has an execution listener for the end event, I would expect it not to be triggered when there's a boundary event attached that doesn't cancel the activity.

Best regards,

jhahn
Champ in-the-making
Champ in-the-making
Whoops, I didn't put it in code block so it got erased. Anyway, just a simple case. After 30Seconds, it executes the expression although the receiveTask hasn't ended.

<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" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="test3" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <receiveTask id="receivetask1" name="Receive Task">
      <extensionElements>
        <activiti:executionListener event="end" expression="${execution.setVariable(&quot;thisShouldntBeSet&quot;, true)}"></activiti:executionListener>
      </extensionElements>
    </receiveTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="receivetask1"></sequenceFlow>
    <boundaryEvent id="boundarytimer1" name="Timer" attachedToRef="receivetask1" cancelActivity="false">
      <timerEventDefinition>
        <timeDuration>PT30S</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow2" sourceRef="receivetask1" targetRef="endevent1"></sequenceFlow>
    <userTask id="usertask1" name="User Task"></userTask>
    <sequenceFlow id="flow3" sourceRef="boundarytimer1" targetRef="usertask1"></sequenceFlow>
    <endEvent id="endevent2" name="End"></endEvent>
    <sequenceFlow id="flow4" sourceRef="usertask1" targetRef="endevent2"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_test3">
    <bpmndi:BPMNPlane bpmnElement="test3" id="BPMNPlane_test3">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="170.0" y="240.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="receivetask1" id="BPMNShape_receivetask1">
        <omgdc:Bounds height="55.0" width="105.0" x="440.0" y="230.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="boundarytimer1" id="BPMNShape_boundarytimer1">
        <omgdc:Bounds height="30.0" width="30.0" x="478.0" y="274.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="590.0" y="240.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="440.0" y="360.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2">
        <omgdc:Bounds height="35.0" width="35.0" x="590.0" y="370.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="205.0" y="257.0"></omgdi:waypoint>
        <omgdi:waypoint x="440.0" y="257.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="545.0" y="257.0"></omgdi:waypoint>
        <omgdi:waypoint x="590.0" y="257.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="493.0" y="304.0"></omgdi:waypoint>
        <omgdi:waypoint x="492.0" y="360.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="545.0" y="387.0"></omgdi:waypoint>
        <omgdi:waypoint x="590.0" y="387.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
</code>

jbarrez
Star Contributor
Star Contributor
Then I think there is a bug here, that the event is thrown even when it's cancelActivity=false.

Could you create a jira issue (so you and us can follow up): https://activiti.atlassian.net/secure/Dashboard.jspa

jhahn
Champ in-the-making
Champ in-the-making
Created issue here
https://activiti.atlassian.net/browse/ACT-3998

Marked it as "high" since it seems like a common basic use case that's not working as intended…