Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix #677] Atomic produce and consume actions #826

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/README_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,6 @@ events:
- contextAttributeName: accountId
- name: ConfirmationCompletedEvent
type: payment.confirmation
kind: produced

```

Expand Down
19 changes: 11 additions & 8 deletions examples/event-based-service-invocation.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
{
"name": "make-vet-appointment",
"source": "VetServiceSource",
"type": "events.vet.appointments",
"kind": "produced"
"type": "events.vet.appointments"
},
{
"name": "vet-appointment-info",
"source": "VetServiceSource",
"type": "events.vet.appointments",
"kind": "consumed"
"type": "events.vet.appointments"
}
],
"states": [
Expand All @@ -26,10 +24,15 @@
"actions": [
{
"name": "make-appointment-action",
"eventRef": {
"produceEventRef": "make-vet-appointment",
"data": "${ .patientInfo }",
"consumeEventRef": "vet-appointment-info"
"produceEventRef": {
"name": "make-vet-appointment",
"data": "${ .patientInfo }"
}
},
{
"name": "wait-appointement-confirmation",
"consumeEventRef": {
"name": "vet-appointment-info"
},
"actionDataFilter": {
"results": "${ .appointmentInfo }"
Expand Down
6 changes: 2 additions & 4 deletions examples/purchase-order-deadline.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,11 @@
},
{
"name": "order-finished-event",
"type": "my.company.orders",
"kind": "produced"
"type": "my.company.orders"
},
{
"name": "order-cancelled-event",
"type": "my.company.orders",
"kind": "produced"
"type": "my.company.orders"
}
],
"functions": [
Expand Down
3 changes: 1 addition & 2 deletions examples/send-cloudevent-on-workflow-completion.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"events": [
{
"name": "provisioning-complete-event",
"type": "provisionCompleteType",
"kind": "produced"
"type": "provisionCompleteType"
}
],
"functions": [
Expand Down
9 changes: 0 additions & 9 deletions schema/events.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@
"type": "string",
"description": "CloudEvent type"
},
"kind": {
"type": "string",
"enum": [
"consumed",
"produced"
],
"description": "Defines the CloudEvent as either 'consumed' or 'produced' by the workflow. Default is 'consumed'",
"default": "consumed"
},
"correlation": {
"type": "array",
"description": "CloudEvent correlation definitions",
Expand Down
56 changes: 38 additions & 18 deletions schema/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,13 @@
"description": "References a function to be invoked",
"$ref": "#/definitions/functionref"
},
"eventRef": {
"description": "References a `produce` and `consume` reusable event definitions",
"$ref": "#/definitions/eventref"
"produceEventRef": {
"description": "References a `produce` reusable event definition",
"$ref": "#/definitions/produceeventref"
},
"consumeEventRef": {
"description": "References a `consume` reusable event definition",
"$ref": "#/definitions/consumeeventref"
},
"subFlowRef": {
"description": "References a sub-workflow to invoke",
Expand Down Expand Up @@ -468,7 +472,13 @@
{
"required": [
"name",
"eventRef"
"produceEventRef"
]
},
{
"required": [
"name",
"consumeEventRef"
]
},
{
Expand Down Expand Up @@ -521,24 +531,15 @@
}
]
},
"eventref": {
"produceeventref": {
cdavernas marked this conversation as resolved.
Show resolved Hide resolved
"type": "object",
"description": "Event References",
"description": "Publish an event",
"properties": {
"produceEventRef": {
"name": {
"type": "string",
"description": "Reference to the unique name of a 'produced' event definition",
"pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"consumeEventRef": {
"type": "string",
"description": "Reference to the unique name of a 'consumed' event definition",
"pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"consumeEventTimeout": {
"type": "string",
"description": "Maximum amount of time (ISO 8601 format) to wait for the result event. If not defined it should default to the actionExecutionTimeout"
},
"data": {
"type": [
"string",
Expand All @@ -556,7 +557,26 @@
},
"additionalProperties": false,
"required": [
"produceEventRef"
"name", "data"
]
},
"consumeeventref": {
"type": "object",
"description": "Waits for an event",
"properties": {
"name": {
"type": "string",
"description": "Reference to the unique name of a 'consumed' event definition",
"pattern": "^[a-z0-9](-?[a-z0-9])*$"
},
"consumeEventTimeout": {
cdavernas marked this conversation as resolved.
Show resolved Hide resolved
"type": "string",
"description": "Maximum amount of time (ISO 8601 format) to wait for the result event. If not defined it should default to the actionExecutionTimeout"
}
},
"additionalProperties": false,
"required": [
"name"
]
},
"subflowref": {
Expand Down Expand Up @@ -1690,7 +1710,7 @@
"name",
"type",
"action",
"eventRef"
""
]
},
"else": {
Expand Down
Loading
Loading