Skip to content

Commit 9c0c7d2

Browse files
committed
[Fix #677] Charles comments
Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
1 parent a19d3a0 commit 9c0c7d2

File tree

3 files changed

+43
-44
lines changed

3 files changed

+43
-44
lines changed

examples/event-based-service-invocation.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
"actions": [
2525
{
2626
"name": "make-appointment-action",
27-
"produceEventRef": {
28-
"name": "make-vet-appointment",
27+
"publish": {
28+
"event": "make-vet-appointment",
2929
"data": "${ .patientInfo }"
3030
}
3131
},
3232
{
3333
"name": "wait-appointement-confirmation",
34-
"consumeEventRef": {
35-
"name": "vet-appointment-info"
34+
"subscribe": {
35+
"event": "vet-appointment-info"
3636
},
3737
"actionDataFilter": {
3838
"results": "${ .appointmentInfo }"

schema/workflow.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,13 @@
413413
"description": "References a function to be invoked",
414414
"$ref": "#/definitions/functionref"
415415
},
416-
"produceEventRef": {
417-
"description": "References a `produce` reusable event definition",
418-
"$ref": "#/definitions/produceeventref"
416+
"publish": {
417+
"description": "Publish an event",
418+
"$ref": "#/definitions/publish"
419419
},
420-
"consumeEventRef": {
421-
"description": "References a `consume` reusable event definition",
422-
"$ref": "#/definitions/consumeeventref"
420+
"subscribe": {
421+
"description": "Subscribe to an event channel",
422+
"$ref": "#/definitions/subscribe"
423423
},
424424
"subFlowRef": {
425425
"description": "References a sub-workflow to invoke",
@@ -472,13 +472,13 @@
472472
{
473473
"required": [
474474
"name",
475-
"produceEventRef"
475+
"publish"
476476
]
477477
},
478478
{
479479
"required": [
480480
"name",
481-
"consumeEventRef"
481+
"subscribe"
482482
]
483483
},
484484
{
@@ -531,21 +531,21 @@
531531
}
532532
]
533533
},
534-
"produceeventref": {
534+
"publish": {
535535
"type": "object",
536536
"description": "Publish an event",
537537
"properties": {
538-
"name": {
538+
"event": {
539539
"type": "string",
540-
"description": "Reference to the unique name of a 'produced' event definition",
540+
"description": "Reference to the unique name of a 'published' event definition",
541541
"pattern": "^[a-z0-9](-?[a-z0-9])*$"
542542
},
543543
"data": {
544544
"type": [
545545
"string",
546546
"object"
547547
],
548-
"description": "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'."
548+
"description": "If string type, an expression which selects parts of the states data output to become the data (payload) of the event referenced by 'publish'. If object type, a custom object to become the data (payload) of the event referenced by 'publish'."
549549
},
550550
"contextAttributes": {
551551
"type": "object",
@@ -560,16 +560,16 @@
560560
"name", "data"
561561
]
562562
},
563-
"consumeeventref": {
563+
"subscribe": {
564564
"type": "object",
565-
"description": "Waits for an event",
565+
"description": "Subscribe to an event channel",
566566
"properties": {
567-
"name": {
567+
"event": {
568568
"type": "string",
569-
"description": "Reference to the unique name of a 'consumed' event definition",
569+
"description": "Reference to the unique name of a 'subscribed' event definition",
570570
"pattern": "^[a-z0-9](-?[a-z0-9])*$"
571571
},
572-
"consumeEventTimeout": {
572+
"timeout": {
573573
"type": "string",
574574
"description": "Maximum amount of time (ISO 8601 format) to wait for the result event. If not defined it should default to the actionExecutionTimeout"
575575
}

specification.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3968,22 +3968,21 @@ functionRef:
39683968

39693969
</details>
39703970

3971-
Actions specify invocations of services or other workflows during workflow execution.
3972-
Service invocation can be done in three different ways:
3971+
An action can:
39733972

39743973
* Reference [functions definitions](#Function-Definition) by its unique name using the `functionRef` property.
3975-
* Reference a [event definitions](#Event-Definition) via the `produceEventRef` property in order to publish that event.
3976-
* Reference a [event definitions](#Event-Definition) via the `consumeEventRef` property in order to consume that event.
3974+
* Publish an event [event definitions](#Event-Definition) via the `publish` property.
3975+
* Subscribe to an event [event definitions](#Event-Definition) via the `subscribe` property.
39773976
* Reference a sub-workflow invocation via the `subFlowRef` property.
39783977

3979-
Note that `functionRef`, `eventRef`, and `subFlowRef` are mutually exclusive, meaning that only one of them can be
3978+
Note that `functionRef`, `publish`, `subscribe` and `subFlowRef` are mutually exclusive, meaning that only one of them can be
39803979
specified in a single action definition.
39813980

39823981
The `name` property specifies the action name.
39833982

39843983
In the event-based scenario a service, or a set of services we want to invoke are not exposed via a specific resource URI for example, but can only be invoked via an event.
3985-
In that case, an event definition might be referenced via its `produceEventRef` property.
3986-
Also, if there is the need to consume an event within a set of actions (for example, wait for the result of a previous action invocation) an event definition might be referenced via its `consumeEventRef` property.
3984+
In that case, an event definition might be referenced via its `publish` property.
3985+
Also, if there is the need to consume an event within a set of actions (for example, wait for the result of a previous action invocation) an event definition might be referenced via its `susbcribe` property.
39873986

39883987
The `sleep` property can be used to define time periods that workflow execution should sleep
39893988
before and/or after function execution. It can have two properties:
@@ -4110,14 +4109,14 @@ In addition, functions that are invoked async do not propagate their errors to t
41104109
workflow state, meaning that any errors that happen during their execution cannot be handled in the workflow states
41114110
onErrors definition. Note that errors raised during functions that are invoked async should not fail workflow execution.
41124111

4113-
##### ProduceEventRef Definition
4112+
##### Publish Definition
41144113

41154114
Publish an event.
41164115

41174116
| Parameter | Description | Type | Required |
41184117
| --- | --- | --- | --- |
4119-
| [name](#Event-Definition) | Reference to the unique name of an event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
4120-
| 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 |
4118+
| [event](#Event-Definition) | Reference to the unique name of an event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
4119+
| data | If string type, an expression which selects parts of the states data output to become the data (payload) of the event referenced by `publish`. If object type, a custom object to become the data (payload) of the event referenced by `publish`. | string or object | yes |
41214120
| contextAttributes | Add additional event extension context attributes to the trigger/produced event | object | no |
41224121

41234122
<details><summary><strong>Click to view example definition</strong></summary>
@@ -4133,8 +4132,8 @@ Publish an event.
41334132

41344133
```json
41354134
{
4136-
"produceEventRef": {
4137-
"name": "make-vet-appointment",
4135+
"publish": {
4136+
"event": "make-vet-appointment",
41384137
"data": "${ .patientInfo }",
41394138
}
41404139
}
@@ -4144,8 +4143,8 @@ Publish an event.
41444143
<td valign="top">
41454144

41464145
```yaml
4147-
produceEventRef:
4148-
name: make-vet-appointment
4146+
publish:
4147+
event: make-vet-appointment
41494148
data: "${ .patientInfo }"
41504149
```
41514150

@@ -4155,22 +4154,22 @@ produceEventRef:
41554154

41564155
</details>
41574156

4158-
Publish an [event definition](#Event-Definition) referenced via the `name` property.
4157+
Publish an [event definition](#Event-Definition) referenced via the `event` property.
41594158

41604159
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
4161-
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.
4160+
to be used as payload of the event referenced by `publish`. If it is of object type, you can define a custom object to be the event payload.
41624161

41634162
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)
41644163
to the trigger/produced event.
41654164

4166-
##### ConsumeEventRef Definition
4165+
##### Susbscribe Definition
41674166

41684167
Wait for an event to arrive.
41694168

41704169
| Parameter | Description | Type | Required |
41714170
| --- | --- | --- | --- |
4172-
| [name](#Event-Definition) | Reference to the unique name of an event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
4173-
| 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 |
4171+
| [event](#Event-Definition) | Reference to the unique name of an event definition. Must follow the [Serverless Workflow Naming Convention](#naming-convention) | string | yes |
4172+
| timeout | 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 |
41744173

41754174
<details><summary><strong>Click to view example definition</strong></summary>
41764175
<p>
@@ -4185,7 +4184,7 @@ Wait for an event to arrive.
41854184

41864185
```json
41874186
{
4188-
"consumeEventRef": {
4187+
"subscribe": {
41894188
"name": "approved-appointment",
41904189
}
41914190
}
@@ -4196,7 +4195,7 @@ Wait for an event to arrive.
41964195

41974196
```yaml
41984197
eventRef:
4199-
consumeEventRef: approved-appointment
4198+
subscribe: approved-appointment
42004199
42014200
```
42024201

@@ -4206,9 +4205,9 @@ eventRef:
42064205

42074206
</details>
42084207

4209-
Consumes an [event definition](#Event-Definition) referenced via the `name` property.
4208+
Consumes an [event definition](#Event-Definition) referenced via the `event` property.
42104209

4211-
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).
4210+
The `timeout` 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).
42124211
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.
42134212

42144213
##### SubFlowRef Definition

0 commit comments

Comments
 (0)