I am currently trying to use a timer event with a timecycle to execute a script task multiple times. I use the following code to define the timer event.
<bpmn:boundaryEvent id="Event_12mc2pf" cancelActivity="false" attachedToRef="Activity_1wf3mho">
<bpmn:timerEventDefinition id="TimerEventDefinition_0c8olxa">
<bpmn:timeCycle xsi:type="bpmn:tFormalExpression">R4/PT30S</bpmn:timeCycle>
</bpmn:timerEventDefinition>
</bpmn:boundaryEvent>
After the timer event there is the script task and after the script task an end event.
When deploying and executing this process the script task is only executed once. Since camunda claims to support this feature my question is, whether I defined the event correctly
(https://i.stack.imgur.com/UuYua.png )
jwulf
August 22, 2022, 1:47am
2
Hi @Ashika_Methal
To help you model this, can you please describe the behaviour that you want?
For example:
Every 30 seconds, send a reminder email, up to four times or until X happens.
Josh
I have to send reminder every 30s until a callback is received
jwulf
August 22, 2022, 3:19am
4
Here is an example of sending it four times, using a FEEL expression as a counter and a conditional gateway:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:modeler="http://camunda.org/schema/modeler/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Web Modeler" exporterVersion="174e755" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.0.0" camunda:diagramRelationId="0aad2acd-3230-4f28-a3ee-61cf850af338">
<bpmn:process id="Process_4f195d89-f99d-4cb3-9fcd-d58eb1506da5" isExecutable="true">
<bpmn:startEvent id="Event_178m3le" name="Incoming email inquiry">
<bpmn:outgoing>Flow_08msgbs</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:subProcess id="Activity_0kbhc3m">
<bpmn:incoming>Flow_08msgbs</bpmn:incoming>
<bpmn:outgoing>Flow_06y1wxp</bpmn:outgoing>
<bpmn:serviceTask id="Activity_0pvu76k" name="Repeat 4x">
<bpmn:extensionElements>
<zeebe:taskDefinition type="repeater" />
<zeebe:ioMapping>
<zeebe:output source="=if counter != null then counter + 1 else 1" target="counter" />
</zeebe:ioMapping>
</bpmn:extensionElements>
<bpmn:incoming>Flow_11ub143</bpmn:incoming>
<bpmn:outgoing>Flow_1dma1o5</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_11ub143" sourceRef="Event_1oho8x5" targetRef="Activity_0pvu76k" />
<bpmn:intermediateCatchEvent id="Event_1oho8x5">
<bpmn:incoming>Flow_0vbj4ht</bpmn:incoming>
<bpmn:incoming>Flow_030l8zp</bpmn:incoming>
<bpmn:outgoing>Flow_11ub143</bpmn:outgoing>
<bpmn:timerEventDefinition id="TimerEventDefinition_0ycdae3">
<bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5S</bpmn:timeDuration>
</bpmn:timerEventDefinition>
</bpmn:intermediateCatchEvent>
<bpmn:startEvent id="Event_0ciulvg">
<bpmn:outgoing>Flow_0vbj4ht</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_0vbj4ht" sourceRef="Event_0ciulvg" targetRef="Event_1oho8x5" />
<bpmn:exclusiveGateway id="Gateway_0mrqc5j" default="Flow_030l8zp">
<bpmn:incoming>Flow_1dma1o5</bpmn:incoming>
<bpmn:outgoing>Flow_030l8zp</bpmn:outgoing>
<bpmn:outgoing>Flow_1u5647p</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="Flow_1dma1o5" sourceRef="Activity_0pvu76k" targetRef="Gateway_0mrqc5j" />
<bpmn:sequenceFlow id="Flow_030l8zp" sourceRef="Gateway_0mrqc5j" targetRef="Event_1oho8x5" />
<bpmn:endEvent id="Event_0gws1mn">
<bpmn:incoming>Flow_1u5647p</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1u5647p" sourceRef="Gateway_0mrqc5j" targetRef="Event_0gws1mn">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=counter = 4</bpmn:conditionExpression>
</bpmn:sequenceFlow>
</bpmn:subProcess>
<bpmn:sequenceFlow id="Flow_08msgbs" sourceRef="Event_178m3le" targetRef="Activity_0kbhc3m" />
<bpmn:sequenceFlow id="Flow_06y1wxp" sourceRef="Activity_0kbhc3m" targetRef="Activity_0ne4hnw" />
<bpmn:endEvent id="Event_073wu64">
<bpmn:incoming>Flow_0bam4ka</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0bam4ka" sourceRef="Activity_0ne4hnw" targetRef="Event_073wu64" />
<bpmn:serviceTask id="Activity_0ne4hnw" name="Something else">
<bpmn:extensionElements>
<zeebe:taskDefinition type="smtgelse" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_06y1wxp</bpmn:incoming>
<bpmn:outgoing>Flow_0bam4ka</bpmn:outgoing>
</bpmn:serviceTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_4f195d89-f99d-4cb3-9fcd-d58eb1506da5">
<bpmndi:BPMNEdge id="Flow_08msgbs_di" bpmnElement="Flow_08msgbs">
<di:waypoint x="178" y="180" />
<di:waypoint x="270" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_06y1wxp_di" bpmnElement="Flow_06y1wxp">
<di:waypoint x="770" y="190" />
<di:waypoint x="850" y="190" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0bam4ka_di" bpmnElement="Flow_0bam4ka">
<di:waypoint x="950" y="190" />
<di:waypoint x="1022" y="190" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Event_178m3le_di" bpmnElement="Event_178m3le">
<dc:Bounds x="142" y="162" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="124" y="205" width="74" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0lmr406_di" bpmnElement="Activity_0ne4hnw">
<dc:Bounds x="850" y="150" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_073wu64_di" bpmnElement="Event_073wu64">
<dc:Bounds x="1022" y="172" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0kbhc3m_di" bpmnElement="Activity_0kbhc3m" isExpanded="true">
<dc:Bounds x="270" y="80" width="500" height="220" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_11ub143_di" bpmnElement="Flow_11ub143">
<di:waypoint x="408" y="180" />
<di:waypoint x="450" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0vbj4ht_di" bpmnElement="Flow_0vbj4ht">
<di:waypoint x="338" y="180" />
<di:waypoint x="372" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1dma1o5_di" bpmnElement="Flow_1dma1o5">
<di:waypoint x="550" y="180" />
<di:waypoint x="595" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_030l8zp_di" bpmnElement="Flow_030l8zp">
<di:waypoint x="620" y="205" />
<di:waypoint x="620" y="270" />
<di:waypoint x="390" y="270" />
<di:waypoint x="390" y="198" />
<bpmndi:BPMNLabel>
<dc:Bounds x="477" y="252" width="56" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1u5647p_di" bpmnElement="Flow_1u5647p">
<di:waypoint x="645" y="180" />
<di:waypoint x="692" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Activity_1swwguk_di" bpmnElement="Activity_0pvu76k">
<dc:Bounds x="450" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1e7g2q8_di" bpmnElement="Event_1oho8x5">
<dc:Bounds x="372" y="162" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0ciulvg_di" bpmnElement="Event_0ciulvg">
<dc:Bounds x="302" y="162" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_0mrqc5j_di" bpmnElement="Gateway_0mrqc5j" isMarkerVisible="true">
<dc:Bounds x="595" y="155" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0gws1mn_di" bpmnElement="Event_0gws1mn">
<dc:Bounds x="692" y="162" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
To make it break on a callback, you can make the callback something like an interrupting boundary message event on the repeater sub-process.
Josh
jwulf
August 22, 2022, 3:39am
5
Like this. You can get rid of the conditional gateway and the counter output variable mapping on the repeated task.
Thankyou so much for the response.After using intermediateCatchEvent with time definition PT30S inside a sub process such that interrupting message callback will terminate it mentioned by you, Its not executing at least once now.ie, Execution is not proceeding to next step if I put intermediate timer event with some delay. If I remove this it is working fine.
I am attaching my process bpmn file. Please let me know if anything wrong from my end.
TestFile3.bpmn (8.4 KB)
jwulf
August 22, 2022, 10:27am
7
The BPMN file does not have task types. Are you using token simulation to test this, or actually running it?
actually running those tasks