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
Copy file name to clipboardExpand all lines: specification.md
+58-28Lines changed: 58 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -3987,7 +3987,8 @@ Actions specify invocations of services or other workflows during workflow execu
3987
3987
Service invocation can be done in three different ways:
3988
3988
3989
3989
* Reference [functions definitions](#Function-Definition) by its unique name using the `functionRef` property.
3990
-
* Reference a `produced` and `consumed` [event definitions](#Event-Definition) via the `eventRef` property.
3990
+
* Reference a `produced` [event definitions](#Event-Definition) via the `produceEventRef` property.
3991
+
* Reference a `consumer` [event definitions](#Event-Definition) via the `consumeEventRef` property.
3991
3992
* Reference a sub-workflow invocation via the `subFlowRef` property.
3992
3993
3993
3994
Note that `functionRef`, `eventRef`, and `subFlowRef` are mutually exclusive, meaning that only one of them can be
@@ -3997,8 +3998,7 @@ The `name` property specifies the action name.
3997
3998
3998
3999
In the event-based scenario a service, or a set of services we want to invoke
3999
4000
are not exposed via a specific resource URI for example, but can only be invoked via an event.
4000
-
The [eventRef](#EventRef-Definition) property defines the
4001
-
referenced `produced` event via its `produceEventRef` property and a `consumed` event via its `consumeEventRef` property.
4001
+
In that case, a `produced` event might be referenced via its `produceEventRef` property and a `consumed` event via its `consumeEventRef` property.
4002
4002
4003
4003
The `sleep` property can be used to define time periods that workflow execution should sleep
4004
4004
before and/or after function execution. It can have two properties:
@@ -4125,18 +4125,15 @@ In addition, functions that are invoked async do not propagate their errors to t
4125
4125
workflow state, meaning that any errors that happen during their execution cannot be handled in the workflow states
4126
4126
onErrors definition. Note that errors raised during functions that are invoked async should not fail workflow execution.
4127
4127
4128
-
##### EventRef Definition
4128
+
##### ProduceEventRef Definition
4129
4129
4130
-
Allows defining invocation of a function via event.
4130
+
Publish an event. It references the unique name of a `produced` event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention)
4131
4131
4132
4132
| Parameter | Description | Type | Required |
4133
4133
| --- | --- | --- | --- |
4134
-
| [produceEventRef](#Event-Definition) | Reference to the unique name of a `produced` event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
4135
-
| [consumeEventRef](#Event-Definition) | Reference to the unique name of a `consumed` event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | no |
4136
-
| consumeEventTimeout | Maximum amount of time (ISO 8601 format literal or expression) to wait for the consume event. If not defined it be set to the [actionExecutionTimeout](#Workflow-Timeout-Definition) | string | no |
4137
-
| data | If string type, an expression which selects parts of the states data output to become the data (payload) of the event referenced by `produceEventRef`. If object type, a custom object to become the data (payload) of the event referenced by `produceEventRef`. | string or object | no |
4134
+
| [name](#Event-Definition) | Reference to the unique name of a `produced` event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
4135
+
| data | If string type, an expression which selects parts of the states data output to become the data (payload) of the event referenced by `produceEventRef`. If object type, a custom object to become the data (payload) of the event referenced by `produceEventRef`. | string or object | yes |
4138
4136
| contextAttributes | Add additional event extension context attributes to the trigger/produced event | object | no |
4139
-
| invoke | Specifies if the function should be invoked sync or async. Default is sync | enum | no |
4140
4137
4141
4138
<details><summary><strong>Click to view example definition</strong></summary>
4142
4139
<p>
@@ -4151,10 +4148,9 @@ Allows defining invocation of a function via event.
4151
4148
4152
4149
```json
4153
4150
{
4154
-
"eventRef": {
4155
-
"produceEventRef": "make-vet-appointment",
4151
+
"produceEventRef": {
4152
+
"name": "make-vet-appointment",
4156
4153
"data": "${ .patientInfo }",
4157
-
"consumeEventRef": "vet-appointment-info"
4158
4154
}
4159
4155
}
4160
4156
```
@@ -4163,10 +4159,9 @@ Allows defining invocation of a function via event.
4163
4159
<td valign="top">
4164
4160
4165
4161
```yaml
4166
-
eventRef:
4167
-
produceEventRef: make-vet-appointment
4162
+
produceEventRef:
4163
+
name: make-vet-appointment
4168
4164
data: "${ .patientInfo }"
4169
-
consumeEventRef: vet-appointment-info
4170
4165
```
4171
4166
4172
4167
</td>
@@ -4175,27 +4170,62 @@ eventRef:
4175
4170
4176
4171
</details>
4177
4172
4178
-
References a `produced` and `consumed` [event definitions](#Event-Definition) via the `produceEventRef` and `consumeEventRef` properties, respectively.
4173
+
References a `produced` [event definitions](#Event-Definition) via the `name` property.
4179
4174
4180
4175
The `data` property can have two types: string or object. If it is of string type, it is an expression that can select parts of state data
4181
4176
to be used as payload of the event referenced by `produceEventRef`. If it is of object type, you can define a custom object to be the event payload.
4182
4177
4183
4178
The `contextAttributes` property allows you to add one or more [extension context attributes](https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md#extension-context-attributes)
4184
4179
to the trigger/produced event.
4185
4180
4181
+
##### ConsumeEventRef Definition
4182
+
4183
+
Wait for an event to arrive.
4184
+
4185
+
| Parameter | Description | Type | Required |
4186
+
| --- | --- | --- | --- |
4187
+
| [name](#Event-Definition) | Reference to the unique name of a `consumed` event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
4188
+
| consumeEventTimeout | Maximum amount of time (ISO 8601 format literal or expression) to wait for the consume event. If not defined it be set to the [actionExecutionTimeout](#Workflow-Timeout-Definition) | string | no |
4189
+
4190
+
<details><summary><strong>Click to view example definition</strong></summary>
4191
+
<p>
4192
+
4193
+
<table>
4194
+
<tr>
4195
+
<th>JSON</th>
4196
+
<th>YAML</th>
4197
+
</tr>
4198
+
<tr>
4199
+
<td valign="top">
4200
+
4201
+
```json
4202
+
{
4203
+
"consumeEventRef": {
4204
+
"name": "approved-appointment",
4205
+
}
4206
+
}
4207
+
```
4208
+
4209
+
</td>
4210
+
<td valign="top">
4211
+
4212
+
```yaml
4213
+
eventRef:
4214
+
consumeEventRef: approved-appointment
4215
+
4216
+
```
4217
+
4218
+
</td>
4219
+
</tr>
4220
+
</table>
4221
+
4222
+
</details>
4223
+
4224
+
References a `consumed` [event definitions](#Event-Definition) via the `name` property.
4225
+
4186
4226
The `consumeEventTimeout` property defines the maximum amount of time (ISO 8601 format literal or expression) to wait for the result event. If not defined it should default to the [actionExecutionTimeout](#Workflow-Timeout-Definition).
4187
-
If the event defined by the `consumeEventRef` property is not received in that set time, action invocation should raise an error
4188
-
that can be handled in the states `onErrors` definition. In case the `consumeEventRef` is not defined, the `consumeEventTimeout` property is ignored.
4227
+
If the event defined by the `name` property is not received in that set time, action invocation should raise an error that can be handled in the states `onErrors` definition.
4189
4228
4190
-
The `invoke` property defines how the function is invoked (sync or async). Default value of this property is
4191
-
`sync`, meaning that workflow execution should wait until the function completes (the result event is received).
4192
-
If set to `async`, workflow execution should just produce the trigger event and should not wait for the result event.
4193
-
Note that in this case the action does not produce any results (payload of the result event) and the associated actions eventDataFilter as well as
4194
-
its retry definition, if defined, should be ignored.
4195
-
Functions that are invoked via events (sync or async) do not propagate their errors to the associated action definition and the
4196
-
workflow state, meaning that any errors that happen during their execution cannot be handled in the workflow states
4197
-
onErrors definition. Note that errors raised during functions that are invoked sync or async in this case
0 commit comments