Skip to content

Commit 7ae6420

Browse files
authored
Merge pull request #826 from fjtirado/Fix_#677
[Fix #677] Atomic produce and consume actions
2 parents 9f79f8f + 30c8fec commit 7ae6420

7 files changed

+122
-99
lines changed

examples/README_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,6 @@ events:
10911091
- contextAttributeName: accountId
10921092
- name: ConfirmationCompletedEvent
10931093
type: payment.confirmation
1094-
kind: produced
10951094

10961095
```
10971096

examples/event-based-service-invocation.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
{
1010
"name": "make-vet-appointment",
1111
"source": "VetServiceSource",
12-
"type": "events.vet.appointments",
13-
"kind": "produced"
12+
"type": "events.vet.appointments"
1413
},
1514
{
1615
"name": "vet-appointment-info",
1716
"source": "VetServiceSource",
18-
"type": "events.vet.appointments",
19-
"kind": "consumed"
17+
"type": "events.vet.appointments"
2018
}
2119
],
2220
"states": [
@@ -26,10 +24,15 @@
2624
"actions": [
2725
{
2826
"name": "make-appointment-action",
29-
"eventRef": {
30-
"produceEventRef": "make-vet-appointment",
31-
"data": "${ .patientInfo }",
32-
"consumeEventRef": "vet-appointment-info"
27+
"publish": {
28+
"event": "make-vet-appointment",
29+
"data": "${ .patientInfo }"
30+
}
31+
},
32+
{
33+
"name": "wait-appointement-confirmation",
34+
"subscribe": {
35+
"event": "vet-appointment-info"
3336
},
3437
"actionDataFilter": {
3538
"results": "${ .appointmentInfo }"

examples/purchase-order-deadline.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,11 @@
137137
},
138138
{
139139
"name": "order-finished-event",
140-
"type": "my.company.orders",
141-
"kind": "produced"
140+
"type": "my.company.orders"
142141
},
143142
{
144143
"name": "order-cancelled-event",
145-
"type": "my.company.orders",
146-
"kind": "produced"
144+
"type": "my.company.orders"
147145
}
148146
],
149147
"functions": [

examples/send-cloudevent-on-workflow-completion.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"events": [
88
{
99
"name": "provisioning-complete-event",
10-
"type": "provisionCompleteType",
11-
"kind": "produced"
10+
"type": "provisionCompleteType"
1211
}
1312
],
1413
"functions": [

schema/events.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@
4343
"type": "string",
4444
"description": "CloudEvent type"
4545
},
46-
"kind": {
47-
"type": "string",
48-
"enum": [
49-
"consumed",
50-
"produced"
51-
],
52-
"description": "Defines the CloudEvent as either 'consumed' or 'produced' by the workflow. Default is 'consumed'",
53-
"default": "consumed"
54-
},
5546
"correlation": {
5647
"type": "array",
5748
"description": "CloudEvent correlation definitions",

schema/workflow.json

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,13 @@
413413
"description": "References a function to be invoked",
414414
"$ref": "#/definitions/functionref"
415415
},
416-
"eventRef": {
417-
"description": "References a `produce` and `consume` reusable event definitions",
418-
"$ref": "#/definitions/eventref"
416+
"publish": {
417+
"description": "Publish an event",
418+
"$ref": "#/definitions/publish"
419+
},
420+
"subscribe": {
421+
"description": "Subscribe to an event channel",
422+
"$ref": "#/definitions/subscribe"
419423
},
420424
"subFlowRef": {
421425
"description": "References a sub-workflow to invoke",
@@ -468,7 +472,13 @@
468472
{
469473
"required": [
470474
"name",
471-
"eventRef"
475+
"publish"
476+
]
477+
},
478+
{
479+
"required": [
480+
"name",
481+
"subscribe"
472482
]
473483
},
474484
{
@@ -521,30 +531,21 @@
521531
}
522532
]
523533
},
524-
"eventref": {
534+
"publish": {
525535
"type": "object",
526-
"description": "Event References",
536+
"description": "Publish an event",
527537
"properties": {
528-
"produceEventRef": {
538+
"event": {
529539
"type": "string",
530-
"description": "Reference to the unique name of a 'produced' event definition",
540+
"description": "Reference to the unique name of a 'published' event definition",
531541
"pattern": "^[a-z0-9](-?[a-z0-9])*$"
532542
},
533-
"consumeEventRef": {
534-
"type": "string",
535-
"description": "Reference to the unique name of a 'consumed' event definition",
536-
"pattern": "^[a-z0-9](-?[a-z0-9])*$"
537-
},
538-
"consumeEventTimeout": {
539-
"type": "string",
540-
"description": "Maximum amount of time (ISO 8601 format) to wait for the result event. If not defined it should default to the actionExecutionTimeout"
541-
},
542543
"data": {
543544
"type": [
544545
"string",
545546
"object"
546547
],
547-
"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'."
548549
},
549550
"contextAttributes": {
550551
"type": "object",
@@ -556,7 +557,26 @@
556557
},
557558
"additionalProperties": false,
558559
"required": [
559-
"produceEventRef"
560+
"event", "data"
561+
]
562+
},
563+
"subscribe": {
564+
"type": "object",
565+
"description": "Subscribe to an event channel",
566+
"properties": {
567+
"event": {
568+
"type": "string",
569+
"description": "Reference to the unique name of a 'subscribed' event definition",
570+
"pattern": "^[a-z0-9](-?[a-z0-9])*$"
571+
},
572+
"timeout": {
573+
"type": "string",
574+
"description": "Maximum amount of time (ISO 8601 format) to wait for the result event. If not defined it should default to the actionExecutionTimeout"
575+
}
576+
},
577+
"additionalProperties": false,
578+
"required": [
579+
"event"
560580
]
561581
},
562582
"subflowref": {
@@ -1690,7 +1710,7 @@
16901710
"name",
16911711
"type",
16921712
"action",
1693-
"eventRef"
1713+
""
16941714
]
16951715
},
16961716
"else": {

0 commit comments

Comments
 (0)