Skip to content

Commit bd6e4ed

Browse files
authored
Merge branch 'main' into feat-lifecycle-cloud-events
2 parents d601036 + db1b5ca commit bd6e4ed

File tree

6 files changed

+98
-9
lines changed

6 files changed

+98
-9
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: listen-to-any
5+
version: '0.1.0'
6+
do:
7+
- callDoctor:
8+
listen:
9+
to:
10+
any: []
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: listen-to-any
5+
version: '0.1.0'
6+
do:
7+
do:
8+
- callDoctor:
9+
listen:
10+
to:
11+
any: []
12+
until:
13+
any: []
14+
until: ${ ($context.events | length) == 3 }

dsl-reference.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1985,8 +1985,9 @@ Represents the configuration of an event consumption strategy.
19851985
| Property | Type | Required | Description |
19861986
|----------|:----:|:--------:|-------------|
19871987
| all | [`eventFilter[]`](#event-filter) | `no` | Configures the workflow to wait for all defined events before resuming execution.<br>*Required if `any` and `one` have not been set.* |
1988-
| any | [`eventFilter[]`](#event-filter) | `no` | Configures the workflow to wait for any of the defined events before resuming execution.<br>*Required if `all` and `one` have not been set.* |
1988+
| any | [`eventFilter[]`](#event-filter) | `no` | Configures the workflow to wait for any of the defined events before resuming execution.<br>*Required if `all` and `one` have not been set.*<br>*If empty, listens to all incoming events, and requires `until` to be set.* |
19891989
| one | [`eventFilter`](#event-filter) | `no` | Configures the workflow to wait for the defined event before resuming execution.<br>*Required if `all` and `any` have not been set.* |
1990+
| until | `string`<br>[`eventConsumptionStrategy`](#event-consumption-strategy) | `no` | Configures the [runtime expression](dsl.md#runtime-expressions) condition or the events that must be consumed to stop listening.<br>*Only applies if `any` has been set, otherwise ignored.* |
19901991

19911992
### Event Properties
19921993

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: listen-to-any
5+
version: '0.1.0'
6+
do:
7+
- callDoctor:
8+
listen:
9+
to:
10+
any: []
11+
until: ( . | length ) > 3 #wait until 3 events have been consumed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
document:
2+
dsl: '1.0.0-alpha1'
3+
namespace: test
4+
name: listen-to-any
5+
version: '0.1.0'
6+
do:
7+
- callDoctor:
8+
listen:
9+
to:
10+
any:
11+
- with:
12+
type: com.fake-hospital.vitals.measurements.temperature
13+
data: ${ .temperature > 38 }
14+
- with:
15+
type: com.fake-hospital.vitals.measurements.bpm
16+
data: ${ .bpm < 60 or .bpm > 100 }
17+
until:
18+
one:
19+
with:
20+
type: com.fake-hospital.patient.checked-out

schema/workflow.yaml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,14 +1309,47 @@ $defs:
13091309
$ref: '#/$defs/eventFilter'
13101310
required: [ all ]
13111311
- title: AnyEventConsumptionStrategy
1312-
properties:
1313-
any:
1314-
type: array
1315-
title: AnyEventConsumptionStrategyConfiguration
1316-
description: A list containing any of the events to consume.
1317-
items:
1318-
$ref: '#/$defs/eventFilter'
1319-
required: [ any ]
1312+
oneOf:
1313+
- properties:
1314+
any:
1315+
type: array
1316+
title: AnyEventConsumptionStrategyConfiguration
1317+
description: A list containing any of the events to consume.
1318+
items:
1319+
$ref: '#/$defs/eventFilter'
1320+
minItems: 1
1321+
until:
1322+
oneOf:
1323+
- type: string
1324+
title: AnyEventUntilCondition
1325+
description: A runtime expression condition evaluated after consuming an event and which determines whether or not to continue listening.
1326+
- allOf:
1327+
- $ref: '#/$defs/eventConsumptionStrategy'
1328+
title: AnyEventUntilConsumed
1329+
description: The strategy that defines the event(s) to consume to stop listening.
1330+
- properties:
1331+
until: false
1332+
required: [ any ]
1333+
- properties:
1334+
any:
1335+
type: array
1336+
title: AnyEventConsumptionStrategyConfiguration
1337+
description: A list containing any of the events to consume.
1338+
items:
1339+
$ref: '#/$defs/eventFilter'
1340+
maxItems: 0
1341+
until:
1342+
oneOf:
1343+
- type: string
1344+
title: AnyEventUntilCondition
1345+
description: A runtime expression condition evaluated after consuming an event and which determines whether or not to continue listening.
1346+
- allOf:
1347+
- $ref: '#/$defs/eventConsumptionStrategy'
1348+
title: AnyEventUntilConsumed
1349+
description: The strategy that defines the event(s) to consume to stop listening.
1350+
- properties:
1351+
until: false
1352+
required: [ any, until ]
13201353
- title: OneEventConsumptionStrategy
13211354
properties:
13221355
one:

0 commit comments

Comments
 (0)