Skip to content

Commit 67ea025

Browse files
committed
chore(example): add boundary event
Helps reproduce camunda/camunda-modeler#5604
1 parent 34f6769 commit 67ea025

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

demo/fixtures/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const input = {
1212
'ServiceTask_2': JSON.stringify({
1313
foo: 1,
1414
bar: 'baz'
15+
}, null, 2),
16+
'ServiceTask_5': JSON.stringify({
17+
jobWorkerDelay: 5
1518
}, null, 2)
1619
};
1720

demo/fixtures/diagram.bpmn

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0jc2nqw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.43.0-rc.0-dev" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.8.0">
2+
<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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0jc2nqw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.44.0-rc.3" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.8.0">
33
<bpmn:process id="Process_TaskTesting" isExecutable="true">
44
<bpmn:startEvent id="StartEvent_1">
55
<bpmn:outgoing>Flow_0d202t1</bpmn:outgoing>
@@ -91,6 +91,7 @@
9191
<zeebe:taskDefinition type="foo" />
9292
<zeebe:ioMapping>
9393
<zeebe:input source="=foo" target="fooLocal" />
94+
<zeebe:input source="=if jobWorkerDelay != null then jobWorkerDelay else 5" target="delay" />
9495
<zeebe:output source="=foo" target="jobWorkerFoo" />
9596
</zeebe:ioMapping>
9697
</bpmn:extensionElements>
@@ -123,6 +124,16 @@
123124
<bpmn:incoming>Flow_0cr1jl0</bpmn:incoming>
124125
</bpmn:endEvent>
125126
<bpmn:sequenceFlow id="Flow_0cr1jl0" sourceRef="ServiceTask_6" targetRef="EndEvent_1" />
127+
<bpmn:boundaryEvent id="Event_1op2ilo" name="10 seconds" attachedToRef="ServiceTask_5">
128+
<bpmn:outgoing>Flow_0mpq4id</bpmn:outgoing>
129+
<bpmn:timerEventDefinition id="TimerEventDefinition_0o7rdih">
130+
<bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT10S</bpmn:timeDuration>
131+
</bpmn:timerEventDefinition>
132+
</bpmn:boundaryEvent>
133+
<bpmn:endEvent id="EndEvent_2">
134+
<bpmn:incoming>Flow_0mpq4id</bpmn:incoming>
135+
</bpmn:endEvent>
136+
<bpmn:sequenceFlow id="Flow_0mpq4id" sourceRef="Event_1op2ilo" targetRef="EndEvent_2" />
126137
</bpmn:process>
127138
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
128139
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_TaskTesting">
@@ -154,6 +165,15 @@
154165
<bpmndi:BPMNShape id="Event_09ccbkf_di" bpmnElement="EndEvent_1">
155166
<dc:Bounds x="1072" y="102" width="36" height="36" />
156167
</bpmndi:BPMNShape>
168+
<bpmndi:BPMNShape id="Event_1y631x8_di" bpmnElement="EndEvent_2">
169+
<dc:Bounds x="912" y="222" width="36" height="36" />
170+
</bpmndi:BPMNShape>
171+
<bpmndi:BPMNShape id="Event_1bi66jq_di" bpmnElement="Event_1op2ilo">
172+
<dc:Bounds x="822" y="142" width="36" height="36" />
173+
<bpmndi:BPMNLabel>
174+
<dc:Bounds x="812" y="185" width="57" height="14" />
175+
</bpmndi:BPMNLabel>
176+
</bpmndi:BPMNShape>
157177
<bpmndi:BPMNEdge id="Flow_0d202t1_di" bpmnElement="Flow_0d202t1">
158178
<di:waypoint x="188" y="120" />
159179
<di:waypoint x="230" y="120" />
@@ -182,6 +202,11 @@
182202
<di:waypoint x="1030" y="120" />
183203
<di:waypoint x="1072" y="120" />
184204
</bpmndi:BPMNEdge>
205+
<bpmndi:BPMNEdge id="Flow_0mpq4id_di" bpmnElement="Flow_0mpq4id">
206+
<di:waypoint x="840" y="178" />
207+
<di:waypoint x="840" y="240" />
208+
<di:waypoint x="912" y="240" />
209+
</bpmndi:BPMNEdge>
185210
</bpmndi:BPMNPlane>
186211
</bpmndi:BPMNDiagram>
187212
</bpmn:definitions>

demo/server.mjs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,18 @@ function createJobWorker() {
186186
camundaRestClient.createJobWorker({
187187
type: 'foo',
188188
jobHandler: async (job) => {
189-
console.log('🚀 Processing job worker...');
189+
console.log(`🚀 Handling job ${job.jobKey}...`);
190+
191+
const { delay = 5 } = job.variables;
192+
193+
console.log(
194+
`Job will take ${delay} seconds to complete...`
195+
);
190196

191197
// Simulate some work with a delay
192-
await new Promise((resolve) => setTimeout(resolve, 2000));
198+
await new Promise((resolve) => setTimeout(resolve, delay * 1000));
193199

194-
console.log('🚀 Job completed');
200+
console.log('🚀 Job completed...');
195201

196202
job.complete({
197203
foo: 'jobWorkerWasHere'

0 commit comments

Comments
 (0)