Skip to content

Commit df15e2f

Browse files
committed
simplify example
1 parent 89e18bd commit df15e2f

File tree

5 files changed

+64
-85
lines changed

5 files changed

+64
-85
lines changed

workflows4s-example/src/main/scala/workflows4s/example/docs/DraftInterruptionExample.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import scala.concurrent.duration.*
44

55
object DraftInterruptionExample {
66

7-
// start_draft
87
object DraftContext extends workflows4s.wio.WorkflowContext {
98
// No need to define State or Event
109
}
1110

1211
import DraftContext._
1312

13+
// start_draft
1414
// Create signal and timeout interruptions
1515
val urgentProcessing = WIO.draft.interruptionSignal("Urgent Processing Request")
1616
val processingTimeout = WIO.draft.interruptionTimeout("Processing Deadline", 2.hours)
@@ -20,8 +20,7 @@ object DraftInterruptionExample {
2020
WIO.draft.step("Validate Document") >>>
2121
WIO.draft.step("Extract Content")
2222
.interruptWith(urgentProcessing) // Can be interrupted for urgent processing
23-
.interruptWith(processingTimeout) >>> // Must complete within 2 hours
24-
WIO.draft.step("Generate Report")
23+
.interruptWith(processingTimeout) // Must complete within 2 hours
2524
// end_draft
2625

2726
}
Lines changed: 58 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,137 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<definitions xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="definitions_0" targetNamespace="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
33
<process camunda:historyTimeToLive="P180D" id="process_2" isExecutable="true">
4-
<startEvent id="startEvent_22">
5-
<outgoing>sequenceFlow_10</outgoing>
4+
<startEvent id="startEvent_20">
5+
<outgoing>sequenceFlow_9</outgoing>
66
</startEvent>
77
<serviceTask id="serviceTask_4" name="Validate Document">
8-
<incoming>sequenceFlow_10</incoming>
9-
<outgoing>sequenceFlow_16</outgoing>
8+
<incoming>sequenceFlow_9</incoming>
9+
<outgoing>sequenceFlow_15</outgoing>
1010
</serviceTask>
11-
<sequenceFlow id="sequenceFlow_10" sourceRef="startEvent_22" targetRef="serviceTask_4"/>
11+
<sequenceFlow id="sequenceFlow_9" sourceRef="startEvent_20" targetRef="serviceTask_4"/>
1212
<subProcess id="subProcess_0">
13-
<incoming>sequenceFlow_16</incoming>
14-
<startEvent id="startEvent_23" name="">
15-
<outgoing>sequenceFlow_13</outgoing>
13+
<incoming>sequenceFlow_15</incoming>
14+
<startEvent id="startEvent_21" name="">
15+
<outgoing>sequenceFlow_12</outgoing>
1616
</startEvent>
1717
<subProcess id="subProcess_1">
18-
<incoming>sequenceFlow_13</incoming>
19-
<startEvent id="startEvent_24" name="">
20-
<outgoing>sequenceFlow_11</outgoing>
18+
<incoming>sequenceFlow_12</incoming>
19+
<startEvent id="startEvent_22" name="">
20+
<outgoing>sequenceFlow_10</outgoing>
2121
</startEvent>
2222
<serviceTask id="serviceTask_5" name="Extract Content">
23-
<incoming>sequenceFlow_11</incoming>
24-
<outgoing>sequenceFlow_12</outgoing>
23+
<incoming>sequenceFlow_10</incoming>
24+
<outgoing>sequenceFlow_11</outgoing>
2525
</serviceTask>
26-
<sequenceFlow id="sequenceFlow_11" sourceRef="startEvent_24" targetRef="serviceTask_5"/>
27-
<endEvent id="endEvent_25">
28-
<incoming>sequenceFlow_12</incoming>
26+
<sequenceFlow id="sequenceFlow_10" sourceRef="startEvent_22" targetRef="serviceTask_5"/>
27+
<endEvent id="endEvent_23">
28+
<incoming>sequenceFlow_11</incoming>
2929
</endEvent>
30-
<sequenceFlow id="sequenceFlow_12" sourceRef="serviceTask_5" targetRef="endEvent_25"/>
30+
<sequenceFlow id="sequenceFlow_11" sourceRef="serviceTask_5" targetRef="endEvent_23"/>
3131
</subProcess>
32-
<sequenceFlow id="sequenceFlow_13" sourceRef="startEvent_23" targetRef="subProcess_1"/>
33-
<boundaryEvent attachedToRef="subProcess_1" id="boundaryEvent_8" name="Urgent Processing Request">
34-
<outgoing>sequenceFlow_14</outgoing>
35-
<signalEventDefinition id="signalEventDefinition_21" signalRef="signal_20"/>
32+
<sequenceFlow id="sequenceFlow_12" sourceRef="startEvent_21" targetRef="subProcess_1"/>
33+
<boundaryEvent attachedToRef="subProcess_1" id="boundaryEvent_7" name="Urgent Processing Request">
34+
<outgoing>sequenceFlow_13</outgoing>
35+
<signalEventDefinition id="signalEventDefinition_19" signalRef="signal_18"/>
3636
</boundaryEvent>
3737
<serviceTask id="serviceTask_6" name="Handle Urgent Processing Request">
38-
<incoming>sequenceFlow_14</incoming>
39-
<outgoing>sequenceFlow_15</outgoing>
38+
<incoming>sequenceFlow_13</incoming>
39+
<outgoing>sequenceFlow_14</outgoing>
4040
</serviceTask>
41-
<sequenceFlow id="sequenceFlow_14" sourceRef="boundaryEvent_8" targetRef="serviceTask_6"/>
42-
<endEvent id="endEvent_26">
43-
<incoming>sequenceFlow_15</incoming>
41+
<sequenceFlow id="sequenceFlow_13" sourceRef="boundaryEvent_7" targetRef="serviceTask_6"/>
42+
<endEvent id="endEvent_24">
43+
<incoming>sequenceFlow_14</incoming>
4444
</endEvent>
45-
<sequenceFlow id="sequenceFlow_15" sourceRef="serviceTask_6" targetRef="endEvent_26"/>
45+
<sequenceFlow id="sequenceFlow_14" sourceRef="serviceTask_6" targetRef="endEvent_24"/>
4646
</subProcess>
47-
<sequenceFlow id="sequenceFlow_16" sourceRef="serviceTask_4" targetRef="subProcess_0"/>
48-
<boundaryEvent attachedToRef="subProcess_0" id="boundaryEvent_9" name="Processing Deadline">
49-
<outgoing>sequenceFlow_17</outgoing>
47+
<sequenceFlow id="sequenceFlow_15" sourceRef="serviceTask_4" targetRef="subProcess_0"/>
48+
<boundaryEvent attachedToRef="subProcess_0" id="boundaryEvent_8" name="Processing Deadline">
49+
<outgoing>sequenceFlow_16</outgoing>
5050
<timerEventDefinition id="timerEventDefinition_3">
51-
<timeDuration id="timeDuration_19"/>
51+
<timeDuration id="timeDuration_17"/>
5252
</timerEventDefinition>
5353
</boundaryEvent>
54-
<serviceTask id="serviceTask_7" name="Generate Report">
55-
<incoming>sequenceFlow_17</incoming>
56-
<outgoing>sequenceFlow_18</outgoing>
57-
</serviceTask>
58-
<sequenceFlow id="sequenceFlow_17" sourceRef="boundaryEvent_9" targetRef="serviceTask_7"/>
59-
<endEvent id="endEvent_27">
60-
<incoming>sequenceFlow_18</incoming>
54+
<endEvent id="endEvent_25">
55+
<incoming>sequenceFlow_16</incoming>
6156
</endEvent>
62-
<sequenceFlow id="sequenceFlow_18" sourceRef="serviceTask_7" targetRef="endEvent_27"/>
57+
<sequenceFlow id="sequenceFlow_16" sourceRef="boundaryEvent_8" targetRef="endEvent_25"/>
6358
</process>
64-
<signal id="signal_20" name="Urgent Processing Request"/>
59+
<signal id="signal_18" name="Urgent Processing Request"/>
6560
<bpmndi:BPMNDiagram id="BpmnDiagram_0">
66-
<bpmndi:BPMNPlane bpmnElement="process_2" id="BpmnPlaneImpl_23">
67-
<bpmndi:BPMNShape bpmnElement="startEvent_22" id="BpmnShapeImpl_9">
61+
<bpmndi:BPMNPlane bpmnElement="process_2" id="BpmnPlaneImpl_21">
62+
<bpmndi:BPMNShape bpmnElement="startEvent_20" id="BpmnShapeImpl_8">
6863
<dc:Bounds height="36.0" width="36.0" x="100.0" y="100.0"/>
6964
</bpmndi:BPMNShape>
70-
<bpmndi:BPMNShape bpmnElement="serviceTask_4" id="BpmnShapeImpl_10">
65+
<bpmndi:BPMNShape bpmnElement="serviceTask_4" id="BpmnShapeImpl_9">
7166
<dc:Bounds height="80.0" width="100.0" x="186.0" y="78.0"/>
7267
</bpmndi:BPMNShape>
73-
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_10" id="BpmnEdgeImpl_0">
68+
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_9" id="BpmnEdgeImpl_0">
7469
<di:waypoint x="136.0" y="118.0"/>
7570
<di:waypoint x="186.0" y="118.0"/>
7671
</bpmndi:BPMNEdge>
77-
<bpmndi:BPMNShape bpmnElement="subProcess_0" id="BpmnShapeImpl_11" isExpanded="true">
72+
<bpmndi:BPMNShape bpmnElement="subProcess_0" id="BpmnShapeImpl_10" isExpanded="true">
7873
<dc:Bounds height="408.0" width="588.5" x="336.0" y="-32.0"/>
7974
</bpmndi:BPMNShape>
80-
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_16" id="BpmnEdgeImpl_1">
75+
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_15" id="BpmnEdgeImpl_1">
8176
<di:waypoint x="286.0" y="118.0"/>
8277
<di:waypoint x="336.0" y="118.0"/>
8378
</bpmndi:BPMNEdge>
84-
<bpmndi:BPMNShape bpmnElement="startEvent_23" id="BpmnShapeImpl_12">
79+
<bpmndi:BPMNShape bpmnElement="startEvent_21" id="BpmnShapeImpl_11">
8580
<dc:Bounds height="36.0" width="36.0" x="386.0" y="100.0"/>
8681
</bpmndi:BPMNShape>
87-
<bpmndi:BPMNShape bpmnElement="subProcess_1" id="BpmnShapeImpl_13" isExpanded="true">
82+
<bpmndi:BPMNShape bpmnElement="subProcess_1" id="BpmnShapeImpl_12" isExpanded="true">
8883
<dc:Bounds height="200.0" width="372.0" x="472.0" y="18.0"/>
8984
</bpmndi:BPMNShape>
90-
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_13" id="BpmnEdgeImpl_2">
85+
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_12" id="BpmnEdgeImpl_2">
9186
<di:waypoint x="422.0" y="118.0"/>
9287
<di:waypoint x="472.0" y="118.0"/>
9388
</bpmndi:BPMNEdge>
94-
<bpmndi:BPMNShape bpmnElement="startEvent_24" id="BpmnShapeImpl_14">
89+
<bpmndi:BPMNShape bpmnElement="startEvent_22" id="BpmnShapeImpl_13">
9590
<dc:Bounds height="36.0" width="36.0" x="522.0" y="100.0"/>
9691
</bpmndi:BPMNShape>
97-
<bpmndi:BPMNShape bpmnElement="serviceTask_5" id="BpmnShapeImpl_15">
92+
<bpmndi:BPMNShape bpmnElement="serviceTask_5" id="BpmnShapeImpl_14">
9893
<dc:Bounds height="80.0" width="100.0" x="608.0" y="78.0"/>
9994
</bpmndi:BPMNShape>
100-
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_11" id="BpmnEdgeImpl_3">
95+
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_10" id="BpmnEdgeImpl_3">
10196
<di:waypoint x="558.0" y="118.0"/>
10297
<di:waypoint x="608.0" y="118.0"/>
10398
</bpmndi:BPMNEdge>
104-
<bpmndi:BPMNShape bpmnElement="endEvent_25" id="BpmnShapeImpl_16">
99+
<bpmndi:BPMNShape bpmnElement="endEvent_23" id="BpmnShapeImpl_15">
105100
<dc:Bounds height="36.0" width="36.0" x="758.0" y="100.0"/>
106101
</bpmndi:BPMNShape>
107-
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_12" id="BpmnEdgeImpl_4">
102+
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_11" id="BpmnEdgeImpl_4">
108103
<di:waypoint x="708.0" y="118.0"/>
109104
<di:waypoint x="758.0" y="118.0"/>
110105
</bpmndi:BPMNEdge>
111-
<bpmndi:BPMNShape bpmnElement="boundaryEvent_8" id="BpmnShapeImpl_17">
106+
<bpmndi:BPMNShape bpmnElement="boundaryEvent_7" id="BpmnShapeImpl_16">
112107
<dc:Bounds height="36.0" width="36.0" x="640.0" y="200.0"/>
113108
</bpmndi:BPMNShape>
114-
<bpmndi:BPMNShape bpmnElement="serviceTask_6" id="BpmnShapeImpl_18">
109+
<bpmndi:BPMNShape bpmnElement="serviceTask_6" id="BpmnShapeImpl_17">
115110
<dc:Bounds height="80.0" width="100.0" x="688.5" y="246.0"/>
116111
</bpmndi:BPMNShape>
117-
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_14" id="BpmnEdgeImpl_5">
112+
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_13" id="BpmnEdgeImpl_5">
118113
<di:waypoint x="658.0" y="236.0"/>
119114
<di:waypoint x="658.0" y="286.0"/>
120115
<di:waypoint x="688.5" y="286.0"/>
121116
</bpmndi:BPMNEdge>
122-
<bpmndi:BPMNShape bpmnElement="endEvent_26" id="BpmnShapeImpl_19">
117+
<bpmndi:BPMNShape bpmnElement="endEvent_24" id="BpmnShapeImpl_18">
123118
<dc:Bounds height="36.0" width="36.0" x="838.5" y="268.0"/>
124119
</bpmndi:BPMNShape>
125-
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_15" id="BpmnEdgeImpl_6">
120+
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_14" id="BpmnEdgeImpl_6">
126121
<di:waypoint x="788.5" y="286.0"/>
127122
<di:waypoint x="838.5" y="286.0"/>
128123
</bpmndi:BPMNEdge>
129-
<bpmndi:BPMNShape bpmnElement="boundaryEvent_9" id="BpmnShapeImpl_20">
124+
<bpmndi:BPMNShape bpmnElement="boundaryEvent_8" id="BpmnShapeImpl_19">
130125
<dc:Bounds height="36.0" width="36.0" x="612.25" y="358.0"/>
131126
</bpmndi:BPMNShape>
132-
<bpmndi:BPMNShape bpmnElement="serviceTask_7" id="BpmnShapeImpl_21">
133-
<dc:Bounds height="80.0" width="100.0" x="660.75" y="404.0"/>
127+
<bpmndi:BPMNShape bpmnElement="endEvent_25" id="BpmnShapeImpl_20">
128+
<dc:Bounds height="36.0" width="36.0" x="660.75" y="426.0"/>
134129
</bpmndi:BPMNShape>
135-
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_17" id="BpmnEdgeImpl_7">
130+
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_16" id="BpmnEdgeImpl_7">
136131
<di:waypoint x="630.25" y="394.0"/>
137132
<di:waypoint x="630.25" y="444.0"/>
138133
<di:waypoint x="660.75" y="444.0"/>
139134
</bpmndi:BPMNEdge>
140-
<bpmndi:BPMNShape bpmnElement="endEvent_27" id="BpmnShapeImpl_22">
141-
<dc:Bounds height="36.0" width="36.0" x="810.75" y="426.0"/>
142-
</bpmndi:BPMNShape>
143-
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_18" id="BpmnEdgeImpl_8">
144-
<di:waypoint x="760.75" y="444.0"/>
145-
<di:waypoint x="810.75" y="444.0"/>
146-
</bpmndi:BPMNEdge>
147135
</bpmndi:BPMNPlane>
148136
</bpmndi:BPMNDiagram>
149137
</definitions>

workflows4s-example/src/test/resources/docs/draft-interruption.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@
3939
},
4040
"handler" : null,
4141
"_type" : "Interruptible"
42-
},
43-
{
44-
"meta" : {
45-
"name" : "Generate Report",
46-
"error" : null,
47-
"description" : null
48-
},
49-
"_type" : "RunIO"
5042
}
5143
],
5244
"_type" : "Sequence"

workflows4s-example/src/test/resources/docs/draft-interruption.mermaid

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,3 @@ node9 --> node10
1414
end
1515
node14@{ shape: stadium, label: "fa:fa-clock Processing Deadline (2h)"}
1616
node2 --> node14
17-
node15["Generate Report"]
18-
node14 --> node15
19-
node10 --> node15
20-
node4 --> node15

workflows4s-example/src/test/resources/docs/draft-interruption.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)