From 3456cb8850fa1c0f4e3277143283c0e62d8c0506 Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Thu, 14 Sep 2023 16:04:30 +0200 Subject: [PATCH] Event changes --- dev/restate/events.proto | 27 +++++++++++---------------- dev/restate/ext.proto | 7 +++++++ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/dev/restate/events.proto b/dev/restate/events.proto index 491d903..98ffc2d 100644 --- a/dev/restate/events.proto +++ b/dev/restate/events.proto @@ -20,33 +20,28 @@ option java_package = "dev.restate.generated"; option go_package = "restate.dev/sdk-go/pb"; message Event { - // Payload - bytes payload = 2; + bytes ordering_key = 1 [(dev.restate.ext.field) = KEY]; - // Metadata - string source = 3; + bytes key = 2; + bytes payload = 3; - // This is filled by the source to retain ordering guarantees, depending on the source type - bytes ordering_key = 1 [(dev.restate.ext.field) = KEY]; map attributes = 15; } message KeyedEvent { + option deprecated = true; + // Payload bytes key = 1 [(dev.restate.ext.field) = KEY]; - bytes payload = 2; - - // Metadata - string source = 3; - map attributes = 15; + bytes payload = 2 [(dev.restate.ext.field) = EVENT_PAYLOAD]; + map attributes = 15 [(dev.restate.ext.field) = EVENT_METADATA]; } message StringKeyedEvent { + option deprecated = true; + // Payload string key = 1 [(dev.restate.ext.field) = KEY]; - bytes payload = 2; - - // Metadata - string source = 3; - map attributes = 15; + bytes payload = 2 [(dev.restate.ext.field) = EVENT_PAYLOAD]; + map attributes = 15 [(dev.restate.ext.field) = EVENT_METADATA]; } diff --git a/dev/restate/ext.proto b/dev/restate/ext.proto index d364eab..ed358f7 100644 --- a/dev/restate/ext.proto +++ b/dev/restate/ext.proto @@ -30,6 +30,13 @@ enum ServiceType { enum FieldType { // protolint:disable:next ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH KEY = 0; + + // Flag a field as event payload. When receiving events, this field will be filled with the event payload. + // Note: only types string and bytes can be used for event payload fields + EVENT_PAYLOAD = 1; + // Flag a field as event metadata. When receiving events, this field will be filled with the event metadata. + // Note: only type map can be used for event payload fields + EVENT_METADATA = 2; } extend google.protobuf.ServiceOptions {