You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -230,9 +231,9 @@ The Serverless Workflow DSL defines a list of [tasks](#task) that **must be** su
230
231
- [Call](#call), used to call services and/or functions.
231
232
- [Do](#do), used to define one or more subtasks to perform in sequence.
232
233
- [Fork](#fork), used to define one or more subtasks to perform concurrently.
233
-
- [Emit](#emit), used to emit [events](#event).
234
+
- [Emit](#emit), used to emit [events](#event-properties).
234
235
- [For](#for), used to iterate over a collection of items, and conditionally perform a task for each of them.
235
-
- [Listen](#listen), used to listen for an [event](#event) or more.
236
+
- [Listen](#listen), used to listen for an [event](#event-properties) or more.
236
237
- [Raise](#raise), used to raise an [error](#error) and potentially fault the [workflow](#workflow).
237
238
- [Run](#run), used to run a [container](#container-process), a [script](#script-process) , a [shell](#shell-process) command or even another [workflow](#workflow-process).
238
239
- [Switch](#switch), used to dynamically select and execute one of multiple alternative paths based on specified conditions
@@ -369,7 +370,7 @@ The [HTTP Call](#http-call) enables workflows to interact with external services
| endpoint | [`endpoint`](#endpoint) | `yes` | An URI or an object that describes the HTTP endpoint to call. |
373
+
| endpoint | `string`\|[`endpoint`](#endpoint) | `yes` | An URI or an object that describes the HTTP endpoint to call. |
373
374
| headers | `map` | `no` | A name/value mapping of the HTTP headers to use, if any. |
374
375
| body | `any` | `no` | The HTTP request body, if any. |
375
376
| query | `map[string, any]` | `no` | A name/value mapping of the query parameters to use, if any. |
@@ -496,7 +497,7 @@ Allows workflows to publish events to event brokers or messaging systems, facili
496
497
497
498
| Name | Type | Required | Description |
498
499
|:--|:---:|:---:|:---|
499
-
| emit.event | [`event`](#event) | `yes` | Defines the event to emit. |
500
+
| emit.event | [`eventProperties`](#event-properties) | `yes` | Defines the event to emit. |
500
501
501
502
##### Examples
502
503
@@ -510,15 +511,16 @@ do:
510
511
- emitEvent:
511
512
emit:
512
513
event:
513
-
source: https://petstore.com
514
-
type: com.petstore.order.placed.v1
515
-
data:
516
-
client:
517
-
firstName: Cruella
518
-
lastName: de Vil
519
-
items:
520
-
- breed: dalmatian
521
-
quantity: 101
514
+
with:
515
+
source: https://petstore.com
516
+
type: com.petstore.order.placed.v1
517
+
data:
518
+
client:
519
+
firstName: Cruella
520
+
lastName: de Vil
521
+
items:
522
+
- breed: dalmatian
523
+
quantity: 101
522
524
```
523
525
524
526
#### For
@@ -530,9 +532,9 @@ Allows workflows to iterate over a collection of items, executing a defined set
530
532
| Name | Type | Required | Description|
531
533
|:--|:---:|:---:|:---|
532
534
| for.each | `string` | `no` | The name of the variable used to store the current item being enumerated.<br>Defaults to `item`. |
533
-
| for.in | `string` | `yes` | A [runtime expression](./dsl.md/#runtime-expressions) used to get the collection to enumerate. |
535
+
| for.in | `string` | `yes` | A [runtime expression](dsl.md#runtime-expressions) used to get the collection to enumerate. |
534
536
| for.at | `string` | `no` | The name of the variable used to store the index of the current item being enumerated.<br>Defaults to `index`. |
535
-
| while | `string` | `no` | A [runtime expression](./dsl.md/#runtime-expressions) that represents the condition, if any, that must be met for the iteration to continue. |
537
+
| while | `string` | `no` | A [runtime expression](dsl.md#runtime-expressions) that represents the condition, if any, that must be met for the iteration to continue. |
536
538
| do | [`task`](#task) | `yes` | The task to perform for each item in the collection. |
537
539
538
540
##### Examples
@@ -965,7 +967,7 @@ do:
965
967
966
968
##### Switch Case
967
969
968
-
Defines a switch case, encompassing of a condition for matching and an associated action to execute upon a match.
970
+
Defines a switch case, encompassing a condition for matching and an associated action to execute upon a match.
969
971
970
972
| Name | Type | Required | Description |
971
973
|:--|:---:|:---:|:---|
@@ -1390,6 +1392,28 @@ Represents the configuration of an event consumption strategy.
1390
1392
| 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.* |
1391
1393
| 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.* |
1392
1394
1395
+
### Event Properties
1396
+
1397
+
An event object typically includes details such as the event type, source, timestamp, and unique identifier along with any relevant data payload. The [Cloud Events specification](https://cloudevents.io/), favored by Serverless Workflow, standardizes this structure to ensure interoperability across different systems and services.
1398
+
1399
+
#### Properties
1400
+
1401
+
| Property | Type | Required | Description |
1402
+
|----------|:----:|:--------:|-------------|
1403
+
| id | `string` | `no` | Identifies the event. `source` + `id` is unique for each distinct event.<br>*Required when emitting an event using `emit.event.with`.* |
1404
+
| source | `string` | `no` | An URI formatted string, or [runtime expression](dsl.md#runtime-expressions), that identifies the context in which an event happened. `source` + `id` is unique for each distinct event.<br>*Required when emitting an event using `emit.event.with`.* |
1405
+
| type | `string` | `no` | Describes the type of event related to the originating occurrence.<br>*Required when emitting an event using `emit.event.with`.* |
1406
+
| time | `string` | `no` | A string, or [runtime expression](dsl.md#runtime-expressions), representing the timestamp of when the occurrence happened. |
1407
+
| subject | `string` | `no` | Describes the subject of the event in the context of the event producer. |
1408
+
| datacontenttype | `string` | `no` | Content type of `data` value. If omitted, it implies the `data` is a JSON value conforming to the "application/json" media type. |
1409
+
| dataschema | `string` | `no` | An URI formatted string, or [runtime expression](dsl.md#runtime-expressions), that identifies the schema that `data` adheres to. |
1410
+
| data | `object` | `no` | The event payload. |
1411
+
1412
+
*Additional properties can be supplied, see the Cloud Events specification [documentation](https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md#extension-context-attributes) for more info.*
1413
+
1414
+
*When used in an [`eventFilter`](#event-filter), at least one property must be supplied.*
1415
+
1416
+
1393
1417
### Event Filter
1394
1418
1395
1419
An event filter is a mechanism used to selectively process or handle events based on predefined criteria, such as event type, source, or specific attributes.
@@ -1398,7 +1422,7 @@ An event filter is a mechanism used to selectively process or handle events base
1398
1422
1399
1423
| Property | Type | Required | Description |
1400
1424
|----------|:----:|:--------:|-------------|
1401
-
| with | `object` | `yes` | A name/value mapping of the attributes filtered events must define. Supports both regular expressions and runtime expressions. |
1425
+
| with | [`eventProperties`](#event-properties) | `yes` | A name/value mapping of the attributes filtered events must define. Supports both regular expressions and runtime expressions. |
1402
1426
| correlate | [`map[string, correlation]`](#correlation) | `no` | A name/definition mapping of the correlations to attempt when filtering events. |
1403
1427
1404
1428
### Correlation
@@ -1474,7 +1498,7 @@ When set, runtimes must validate input data against the defined schema, unless d
1474
1498
| Property | Type | Required | Description |
1475
1499
|----------|:----:|:--------:|-------------|
1476
1500
| schema | [`schema`](#schema) | `no` | The [`schema`](#schema) used to describe and validate input data.<br>*Even though the schema is not required, it is strongly encouraged to document it, whenever feasible.* |
1477
-
| from | `string`<br>`object` | `no` | A [runtime expression](#runtime-expressions), if any, used to filter and/or mutate the workflow/task input. |
1501
+
| from | `string`<br>`object` | `no` | A [runtime expression](dsl.md#runtime-expressions), if any, used to filter and/or mutate the workflow/task input. |
1478
1502
1479
1503
#### Examples
1480
1504
@@ -1503,7 +1527,7 @@ When set, runtimes must validate output data against the defined schema, unless
1503
1527
| Property | Type | Required | Description |
1504
1528
|----------|:----:|:--------:|-------------|
1505
1529
| schema | [`schema`](#schema) | `no` | The [`schema`](#schema) used to describe and validate output data.<br>*Even though the schema is not required, it is strongly encouraged to document it, whenever feasible.* |
1506
-
| as | `string`<br>`object` | `no` | A [runtime expression](#runtime-expressions), if any, used to filter and/or mutate the workflow/task output. |
1530
+
| as | `string`<br>`object` | `no` | A [runtime expression](dsl.md#runtime-expressions), if any, used to filter and/or mutate the workflow/task output. |
1507
1531
1508
1532
#### Examples
1509
1533
@@ -1637,6 +1661,17 @@ minutes: 15
1637
1661
seconds: 30
1638
1662
```
1639
1663
1664
+
### Endpoint
1665
+
1666
+
Describes an enpoint.
1667
+
1668
+
#### Properties
1669
+
1670
+
| Property | Type | Required | Description |
1671
+
|----------|:----:|:--------:|-------------|
1672
+
| uri | `string` | `yes` | The endpoint's URI. |
1673
+
| authentication | `[authentication](#authentication)` | `no` | The authentication policy to use. |
Copy file name to clipboardExpand all lines: dsl.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ Workflows in the Serverless Workflow DSL can exist in several phases, each indic
81
81
82
82
Additionally, the flow of execution within a workflow can be controlled using [directives*](dsl-reference.md#flow-directive), which provide instructions to the workflow engine on how to manage and handle specific aspects of workflow execution.
83
83
84
-
**To learn more about flow directives and how they can be utilized to control the execution and behavior of workflows, please refer to [Flow Directives](dsl-reference.md#flow-directive).*
84
+
\**To learn more about flow directives and how they can be utilized to control the execution and behavior of workflows, please refer to [Flow Directives](dsl-reference.md#flow-directive).*
85
85
86
86
#### Components
87
87
@@ -102,14 +102,14 @@ The Serverless Workflow DSL defines several default [task](dsl-reference.md#task
102
102
103
103
-[Call](dsl-reference.md#call), used to call services and/or functions.
104
104
-[Do](dsl-reference.md#do), used to define one or more subtasks to perform in sequence.
105
-
-[Fork](dsl-reference.md#fork), used to define one or more two subtasks to perform in parallel.
106
105
-[Emit](dsl-reference.md#emit), used to emit [events](dsl-reference.md#event).
107
106
-[For](dsl-reference.md#for), used to iterate over a collection of items, and conditionally perform a task for each of them.
107
+
-[Fork](dsl-reference.md#fork), used to define one or more two subtasks to perform in parallel.
108
108
-[Listen](dsl-reference.md#listen), used to listen for an [event](dsl-reference.md#event) or more.
109
109
-[Raise](dsl-reference.md#raise), used to raise an [error](dsl-reference.md#error) and potentially fault the [workflow](dsl-reference.md#workflow).
110
110
-[Run](dsl-reference.md#run), used to run a [container](dsl-reference.md#container-process), a [script](dsl-reference.md#script-process), a [shell](dsl-reference.md#shell-process) command or even another [workflow](dsl-reference.md#workflow-process).
111
-
-[Switch](dsl-reference.md#switch), used to dynamically select and execute one of multiple alternative paths based on specified conditions
112
111
-[Set](dsl-reference.md#set), used to dynamically set or update the [workflow](dsl-reference.md#workflow)'s data during the its execution.
112
+
-[Switch](dsl-reference.md#switch), used to dynamically select and execute one of multiple alternative paths based on specified conditions
113
113
-[Try](dsl-reference.md#try), used to attempt executing a specified [task](dsl-reference.md#task), and to handle any resulting [errors](dsl-reference.md#error) gracefully, allowing the [workflow](dsl-reference.md#workflow) to continue without interruption.
114
114
-[Wait](dsl-reference.md#wait), used to pause or wait for a specified duration before proceeding to the next task.
115
115
@@ -138,7 +138,7 @@ A workflow begins with the first task defined.
138
138
139
139
Once the task has been executed, different things can happen:
140
140
141
-
-`continue`: the task ran to completion, and the next task, if any, should be executed. The task to run next is implictly the next in declaration order, or explicitly defined by the `then` property of the executed task. If the executed task is the last task, then the workflow's execution gracefully ends.
141
+
-`continue`: the task ran to completion, and the next task, if any, should be executed. The task to run next is implicitly the next in declaration order, or explicitly defined by the `then` property of the executed task. If the executed task is the last task, then the workflow's execution gracefully ends.
142
142
-`fault`: the task raised an uncaught error, which abruptly halts the workflow's execution and makes it transition to `faulted`[status phase](#status-phases).
143
143
-`end`: the task explicitly and gracefully ends the workflow's execution.
description: Identifies the context in which an event happened
377
-
oneOf:
378
-
- title: LiteralSource
379
-
type: string
380
-
format: uri-template
381
-
- $ref: '#/$defs/runtimeExpression'
382
-
type:
383
-
type: string
384
-
description: This attribute contains a value describing the type of event related to the originating occurrence.
385
-
time:
386
-
oneOf:
387
-
- title: LiteralTime
388
-
type: string
389
-
format: date-time
390
-
- $ref: '#/$defs/runtimeExpression'
391
-
subject:
392
-
type: string
393
-
datacontenttype:
394
-
type: string
395
-
description: Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.
396
-
dataschema:
397
-
oneOf:
398
-
- title: LiteralDataSchema
399
-
type: string
400
-
format: uri-template
401
-
- $ref: '#/$defs/runtimeExpression'
402
-
required: [ source, type ]
373
+
with:
374
+
$ref: '#/$defs/eventProperties'
375
+
required: [ source, type ]
403
376
additionalProperties: true
404
377
required: [ event ]
405
378
forTask:
@@ -852,6 +825,40 @@ $defs:
852
825
$ref: '#/$defs/referenceableAuthenticationPolicy'
853
826
description: The authentication policy to use.
854
827
required: [ uri ]
828
+
eventProperties:
829
+
type: object
830
+
properties:
831
+
id:
832
+
type: string
833
+
description: The event's unique identifier
834
+
source:
835
+
description: Identifies the context in which an event happened
836
+
oneOf:
837
+
- title: LiteralSource
838
+
type: string
839
+
format: uri-template
840
+
- $ref: '#/$defs/runtimeExpression'
841
+
type:
842
+
type: string
843
+
description: This attribute contains a value describing the type of event related to the originating occurrence.
844
+
time:
845
+
oneOf:
846
+
- title: LiteralTime
847
+
type: string
848
+
format: date-time
849
+
- $ref: '#/$defs/runtimeExpression'
850
+
subject:
851
+
type: string
852
+
datacontenttype:
853
+
type: string
854
+
description: Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.
855
+
dataschema:
856
+
oneOf:
857
+
- title: LiteralDataSchema
858
+
type: string
859
+
format: uri-template
860
+
- $ref: '#/$defs/runtimeExpression'
861
+
additionalProperties: true
855
862
eventConsumptionStrategy:
856
863
type: object
857
864
unevaluatedProperties: false
@@ -884,28 +891,8 @@ $defs:
884
891
properties:
885
892
with:
886
893
title: WithEvent
887
-
type: object
894
+
$ref: '#/$defs/eventProperties'
888
895
minProperties: 1
889
-
properties:
890
-
id:
891
-
type: string
892
-
description: The event's unique identifier
893
-
source:
894
-
type: string
895
-
description: Identifies the context in which an event happened
896
-
type:
897
-
type: string
898
-
description: This attribute contains a value describing the type of event related to the originating occurrence.
899
-
time:
900
-
type: string
901
-
subject:
902
-
type: string
903
-
datacontenttype:
904
-
type: string
905
-
description: Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.
906
-
dataschema:
907
-
type: string
908
-
additionalProperties: true
909
896
description: An event filter is a mechanism used to selectively process or handle events based on predefined criteria, such as event type, source, or specific attributes.
0 commit comments