From 818f08c9638b945a31da9fd4624141bedb60b0ae Mon Sep 17 00:00:00 2001 From: Charles d'Avernas Date: Wed, 8 Jan 2025 12:18:13 +0100 Subject: [PATCH 1/4] Add a new `to` property to the `emit` task, used to configure an additional endpoint to publish the configured event to Closes #1026 Signed-off-by: Charles d'Avernas --- dsl-reference.md | 1 + examples/emit-additional-sink.yaml | 20 ++++++++++++++++++++ schema/workflow.yaml | 6 +++++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 examples/emit-additional-sink.yaml diff --git a/dsl-reference.md b/dsl-reference.md index 92b02d60..26580e7b 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -508,6 +508,7 @@ Allows workflows to publish events to event brokers or messaging systems, facili | Name | Type | Required | Description | |:--|:---:|:---:|:---| | emit.event | [`eventProperties`](#event-properties) | `yes` | Defines the event to emit. | +| emit.to | [`endpoint`](#endpoint) | `no` | Specifies an additional endpoint for emitting the event. While the runtime's default cloud event endpoint remains the primary destination, setting this property ensures that the event is also published to the specified endpoint. Ideally, this property is left unset so that event delivery relies solely on the runtime's configured endpoint, but when provided, the event will be sent to both endpoints concurrently. | ##### Examples diff --git a/examples/emit-additional-sink.yaml b/examples/emit-additional-sink.yaml new file mode 100644 index 00000000..c4de4224 --- /dev/null +++ b/examples/emit-additional-sink.yaml @@ -0,0 +1,20 @@ +document: + dsl: '1.0.0-alpha5' + namespace: test + name: emit + version: '0.1.0' +do: + - emitEvent: + emit: + event: + with: + source: https://petstore.com + type: com.petstore.order.placed.v1 + data: + client: + firstName: Cruella + lastName: de Vil + items: + - breed: dalmatian + quantity: 101 + to: https://additional-cloud-event-sink.com/pub \ No newline at end of file diff --git a/schema/workflow.yaml b/schema/workflow.yaml index aecbeacb..9582ba3e 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -1,4 +1,4 @@ -$id: https://serverlessworkflow.io/schemas/1.0.0-alpha5/workflow.yaml +$id: https://serverlessworkflow.io/schemas/1.0.0-alpha6/workflow.yaml $schema: https://json-schema.org/draft/2020-12/schema description: Serverless Workflow DSL - Workflow Schema. type: object @@ -482,6 +482,10 @@ $defs: description: Defines the properties of event to emit. required: [ source, type ] additionalProperties: true + to: + $ref: '#/$defs/endpoint' + title: EmitEndpointDefinition + description: Defines the additional endpoint, if any, to emit the event to. required: [ event ] forTask: type: object From d53c269b232403b3c72e9706ae072ecaad00a884 Mon Sep 17 00:00:00 2001 From: Charles d'Avernas Date: Wed, 8 Jan 2025 12:22:11 +0100 Subject: [PATCH 2/4] Reverted schema version to `alpha5` to ensure proper testing Signed-off-by: Charles d'Avernas --- schema/workflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 9582ba3e..28889fe4 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -1,4 +1,4 @@ -$id: https://serverlessworkflow.io/schemas/1.0.0-alpha6/workflow.yaml +$id: https://serverlessworkflow.io/schemas/1.0.0-alpha5/workflow.yaml $schema: https://json-schema.org/draft/2020-12/schema description: Serverless Workflow DSL - Workflow Schema. type: object From b3499f8b579e195c6763b35093cd9ec42e2d5ad1 Mon Sep 17 00:00:00 2001 From: Charles d'Avernas Date: Thu, 9 Jan 2025 11:28:40 +0100 Subject: [PATCH 3/4] Rename `emit.to` to `emit.cc`, as requested by comments Signed-off-by: Charles d'Avernas --- dsl-reference.md | 2 +- schema/workflow.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dsl-reference.md b/dsl-reference.md index 02d9ff3d..45fe74b4 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -532,7 +532,7 @@ Allows workflows to publish events to event brokers or messaging systems, facili | Name | Type | Required | Description | |:--|:---:|:---:|:---| | emit.event | [`eventProperties`](#event-properties) | `yes` | Defines the event to emit. | -| emit.to | [`endpoint`](#endpoint) | `no` | Specifies an additional endpoint for emitting the event. While the runtime's default cloud event endpoint remains the primary destination, setting this property ensures that the event is also published to the specified endpoint. Ideally, this property is left unset so that event delivery relies solely on the runtime's configured endpoint, but when provided, the event will be sent to both endpoints concurrently. | +| emit.cc | [`endpoint`](#endpoint) | `no` | Specifies an additional endpoint for emitting a carbon copy of the event. While the runtime's default cloud event endpoint remains the primary destination, setting this property ensures that the event is also published to the specified endpoint. Ideally, this property is left unset so that event delivery relies solely on the runtime's configured endpoint, but when provided, the event will be sent to both endpoints concurrently. | ##### Examples diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 3b2533c0..8fcf0f57 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -491,10 +491,10 @@ $defs: description: Defines the properties of event to emit. required: [ source, type ] additionalProperties: true - to: + cc: $ref: '#/$defs/endpoint' - title: EmitEndpointDefinition - description: Defines the additional endpoint, if any, to emit the event to. + title: EmitCarbonCopyDefinition + description: Defines an additional endpoint, if any, to publish an event's carbon copy to. required: [ event ] forTask: type: object From 47696f5237b577814a29faa7b19c679b32ca2930 Mon Sep 17 00:00:00 2001 From: Charles d'Avernas Date: Thu, 9 Jan 2025 11:29:30 +0100 Subject: [PATCH 4/4] Fix examples Signed-off-by: Charles d'Avernas --- examples/{emit-additional-sink.yaml => emit-cc.yaml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename examples/{emit-additional-sink.yaml => emit-cc.yaml} (88%) diff --git a/examples/emit-additional-sink.yaml b/examples/emit-cc.yaml similarity index 88% rename from examples/emit-additional-sink.yaml rename to examples/emit-cc.yaml index c4de4224..8a481a9e 100644 --- a/examples/emit-additional-sink.yaml +++ b/examples/emit-cc.yaml @@ -17,4 +17,4 @@ do: items: - breed: dalmatian quantity: 101 - to: https://additional-cloud-event-sink.com/pub \ No newline at end of file + cc: https://additional-cloud-event-sink.com/pub \ No newline at end of file