cancel
Showing results for 
Search instead for 
Did you mean: 

removing timer job events for a process

ganeshr
Champ in-the-making
Champ in-the-making
Hi,

  I have used the inclusive gateway in my process, created four outgoing sequences with the help of inclusive gateway and this outgoing sequences will execute in all scenarios. I have created a human task in one of the sequence flow and intermediate timer catching events in other sequences. So, when I complete the human task before completing the other sequences, still the time jobs are there in job table and they are firing only when the duration reaches, because of this process is not ending. But my requirement is after completing the task the process should end immediately, instead of waiting for other sequences to execute. Is it possible to remove the timer jobs ?

Here is my bpmn

<?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="managementprocess" name="management-process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="ValidationServiceTask" name="Validate Duedate" activiti:class="com.uprr.netcontrol.workflow.tmi.services.EvaluateDatesCondition"></serviceTask>
    <sequenceFlow id="flow5" sourceRef="startevent1" targetRef="ValidationServiceTask"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway3" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow6" name="DueDate &gt; Current Date" sourceRef="ValidationServiceTask" targetRef="exclusivegateway3"></sequenceFlow>
    <userTask id="ManagementHumanTask" name="HumanTask" activiti:candidateGroups="${taskAssignee}">
      <extensionElements>
      
        <activiti:formProperty id="warningDatetime" name="WarningDatetime" type="string" expression="${warningDatetime}" writable="false"></activiti:formProperty>
        <activiti:formProperty id="dueDatetime" name="DueDateTime" type="string" expression="${dueDatetime}" writable="false"></activiti:formProperty>
        <activiti:formProperty id="expirationDuration" name="ExpirationDuration" type="string" expression="${expirationDuration}" writable="false"></activiti:formProperty>
      
        <activiti:taskListener event="all" expression="#{workflowTaskListner.notify(task)}"></activiti:taskListener>
      </extensionElements>
    </userTask>
    <endEvent id="endevent3" name="End"></endEvent>
    <sequenceFlow id="flow11" name="Sucess" sourceRef="exclusivegateway3" targetRef="inclusivegateway1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${isDueDateGreater  == true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow14" name="failure" sourceRef="exclusivegateway3" targetRef="endevent3">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${isDueDateGreater  == false}]]></conditionExpression>
    </sequenceFlow>
    <inclusiveGateway id="inclusivegateway1" name="Inclusive Gateway"></inclusiveGateway>
    <intermediateCatchEvent id="TimeLineWarningAlert" name="TimeLineWarningAlert">
      <timerEventDefinition>
        <timeDuration>${TLWarningAlertDuration}</timeDuration>
      </timerEventDefinition>
    </intermediateCatchEvent>
    <sequenceFlow id="flow17" sourceRef="inclusivegateway1" targetRef="TimeLineWarningAlert">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${isDueDateGreater  == true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow18" sourceRef="inclusivegateway1" targetRef="ManagementHumanTask">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${isDueDateGreater  == true}]]></conditionExpression>
    </sequenceFlow>
    <serviceTask id="warningAlert" name="warningAlert" activiti:expression="#{timeLineAlertNotificationService.execute(execution)}"></serviceTask>
    <sequenceFlow id="flow22" sourceRef="TimeLineWarningAlert" targetRef="warningAlert"></sequenceFlow>
    <intermediateCatchEvent id="TimeLineLateAlert" name="TimeLineLateAlert">
      <timerEventDefinition>
        <timeDuration>${TLLateAlertDuration}</timeDuration>
      </timerEventDefinition>
    </intermediateCatchEvent>
    <serviceTask id="LateAlert" name="LateAlert" activiti:expression="#{timeLineAlertNotificationService.execute(execution)}"></serviceTask>
    <sequenceFlow id="flow24" sourceRef="TimeLineLateAlert" targetRef="LateAlert"></sequenceFlow>
    <intermediateCatchEvent id="TaskDurationExpirationEvent" name="TaskDurationExpirationEvent">
      <timerEventDefinition>
        <timeDuration>${expirationDuration}</timeDuration>
      </timerEventDefinition>
    </intermediateCatchEvent>
    <serviceTask id="TaskExpirationEvent" name="TaskExpirationEvent" activiti:expression="#{timeLineAlertNotificationService.execute(execution)}"></serviceTask>
    <sequenceFlow id="flow26" sourceRef="TaskDurationExpirationEvent" targetRef="TaskExpirationEvent"></sequenceFlow>
    <endEvent id="endevent4" name="End"></endEvent>
    <sequenceFlow id="flow27" sourceRef="ManagementHumanTask" targetRef="endevent4"></sequenceFlow>
    <endEvent id="endevent5" name="End"></endEvent>
    <sequenceFlow id="flow28" sourceRef="LateAlert" targetRef="endevent5"></sequenceFlow>
    <endEvent id="endevent6" name="End"></endEvent>
    <sequenceFlow id="flow29" sourceRef="TaskExpirationEvent" targetRef="endevent6"></sequenceFlow>
    <endEvent id="endevent7" name="End"></endEvent>
    <sequenceFlow id="flow30" sourceRef="warningAlert" targetRef="endevent7"></sequenceFlow>
    <sequenceFlow id="flow31" sourceRef="inclusivegateway1" targetRef="TimeLineLateAlert">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${isDueDateGreater  == true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow32" sourceRef="inclusivegateway1" targetRef="TaskDurationExpirationEvent">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${isDueDateGreater  == true}]]></conditionExpression>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_managementprocess">
    <bpmndi:BPMNPlane bpmnElement="managementprocess" id="BPMNPlane_managementprocess">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="70.0" y="150.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway3" id="BPMNShape_exclusivegateway3">
        <omgdc:Bounds height="40.0" width="40.0" x="370.0" y="147.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent3" id="BPMNShape_endevent3">
        <omgdc:Bounds height="35.0" width="35.0" x="610.0" y="50.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent4" id="BPMNShape_endevent4">
        <omgdc:Bounds height="35.0" width="35.0" x="804.0" y="322.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="ValidationServiceTask" id="BPMNShape_ValidationServiceTask">
        <omgdc:Bounds height="55.0" width="105.0" x="160.0" y="140.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="ManagementHumanTask" id="BPMNShape_ManagementHumanTask">
        <omgdc:Bounds height="55.0" width="116.0" x="639.0" y="312.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="TimeLineWarningAlert" id="BPMNShape_TimeLineWarningAlert">
        <omgdc:Bounds height="35.0" width="35.0" x="560.0" y="228.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="TimeLineLateAlert" id="BPMNShape_TimeLineLateAlert">
        <omgdc:Bounds height="35.0" width="35.0" x="560.0" y="410.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="inclusivegateway1" id="BPMNShape_inclusivegateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="400.0" y="320.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="warningAlert" id="BPMNShape_warningAlert">
        <omgdc:Bounds height="55.0" width="105.0" x="644.0" y="218.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
        <omgdc:Bounds height="55.0" width="105.0" x="1060.0" y="252.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="LateAlert" id="BPMNShape_LateAlert">
        <omgdc:Bounds height="55.0" width="105.0" x="650.0" y="400.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="timerintermediatecatchevent1" id="BPMNShape_timerintermediatecatchevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="1000.0" y="228.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="TaskDurationExpirationEvent" id="BPMNShape_TaskDurationExpirationEvent">
        <omgdc:Bounds height="35.0" width="35.0" x="560.0" y="480.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="TaskExpirationEvent" id="BPMNShape_TaskExpirationEvent">
        <omgdc:Bounds height="55.0" width="105.0" x="650.0" y="470.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent5" id="BPMNShape_endevent5">
        <omgdc:Bounds height="35.0" width="35.0" x="804.0" y="410.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent6" id="BPMNShape_endevent6">
        <omgdc:Bounds height="35.0" width="35.0" x="804.0" y="480.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent7" id="BPMNShape_endevent7">
        <omgdc:Bounds height="35.0" width="35.0" x="804.0" y="228.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="105.0" y="167.0"></omgdi:waypoint>
        <omgdi:waypoint x="160.0" y="167.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="265.0" y="167.0"></omgdi:waypoint>
        <omgdi:waypoint x="370.0" y="167.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="42.0" width="100.0" x="-28.0" y="-37.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
        <omgdi:waypoint x="390.0" y="187.0"></omgdi:waypoint>
        <omgdi:waypoint x="390.0" y="287.0"></omgdi:waypoint>
        <omgdi:waypoint x="390.0" y="338.0"></omgdi:waypoint>
        <omgdi:waypoint x="400.0" y="340.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="14.0" width="37.0" x="3.0" y="-18.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow14" id="BPMNEdge_flow14">
        <omgdi:waypoint x="390.0" y="147.0"></omgdi:waypoint>
        <omgdi:waypoint x="390.0" y="67.0"></omgdi:waypoint>
        <omgdi:waypoint x="610.0" y="67.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="14.0" width="30.0" x="-66.0" y="4.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow17" id="BPMNEdge_flow17">
        <omgdi:waypoint x="420.0" y="320.0"></omgdi:waypoint>
        <omgdi:waypoint x="420.0" y="300.0"></omgdi:waypoint>
        <omgdi:waypoint x="480.0" y="245.0"></omgdi:waypoint>
        <omgdi:waypoint x="560.0" y="245.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow18" id="BPMNEdge_flow18">
        <omgdi:waypoint x="440.0" y="340.0"></omgdi:waypoint>
        <omgdi:waypoint x="639.0" y="339.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow22" id="BPMNEdge_flow22">
        <omgdi:waypoint x="595.0" y="245.0"></omgdi:waypoint>
        <omgdi:waypoint x="644.0" y="245.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow24" id="BPMNEdge_flow24">
        <omgdi:waypoint x="595.0" y="427.0"></omgdi:waypoint>
        <omgdi:waypoint x="650.0" y="427.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow26" id="BPMNEdge_flow26">
        <omgdi:waypoint x="595.0" y="497.0"></omgdi:waypoint>
        <omgdi:waypoint x="650.0" y="497.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow27" id="BPMNEdge_flow27">
        <omgdi:waypoint x="755.0" y="339.0"></omgdi:waypoint>
        <omgdi:waypoint x="804.0" y="339.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow28" id="BPMNEdge_flow28">
        <omgdi:waypoint x="755.0" y="427.0"></omgdi:waypoint>
        <omgdi:waypoint x="804.0" y="427.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow29" id="BPMNEdge_flow29">
        <omgdi:waypoint x="755.0" y="497.0"></omgdi:waypoint>
        <omgdi:waypoint x="804.0" y="497.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow30" id="BPMNEdge_flow30">
        <omgdi:waypoint x="749.0" y="245.0"></omgdi:waypoint>
        <omgdi:waypoint x="804.0" y="245.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow31" id="BPMNEdge_flow31">
        <omgdi:waypoint x="420.0" y="360.0"></omgdi:waypoint>
        <omgdi:waypoint x="420.0" y="427.0"></omgdi:waypoint>
        <omgdi:waypoint x="560.0" y="427.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow32" id="BPMNEdge_flow32">
        <omgdi:waypoint x="420.0" y="360.0"></omgdi:waypoint>
        <omgdi:waypoint x="420.0" y="497.0"></omgdi:waypoint>
        <omgdi:waypoint x="560.0" y="497.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

3 REPLIES 3

ganeshr
Champ in-the-making
Champ in-the-making
adding bpm text file, as unable to paste in description

one87
Champ in-the-making
Champ in-the-making
This might help, although I've never tested it myself.
http://www.activiti.org/userguide/#api.services.suspend

It's also possible to suspend a process instance. When suspended, the process cannot be continued (e.g. completing a task throws an exception) and no jobs (such as timers) will executed. Suspending a process instance can be done by calling the runtimeService.suspendProcessInstance method. Activating the process instance again is done by calling the runtimeService.activateProcessInstanceXXX methods.

frederikherema1
Star Contributor
Star Contributor
I've answered a similar question recently on the forum. Instead of working with the gateways, create a sub-process around the part of your process you want to have the "timer" behavior for. Instead of adding the timer INSIDE the sub-process, add it as a boundary-event on the sub-process.

In case all tasks are complete (in the subprocess) before the timer has fired, the subprocess-scope will be destroyed and the boundary-event will be removed. If you have an outgoing flow from the subprocess to a process end-event, the process will be ended after the last task is finished.

If the timer fires first, you can either send a reminder (but leave the other tasks as they are) by using cancelActivity="true" or terminate all tasks in the sub-process by using cancelActivity="true" on the boundary timer event.