From 1ea9c82867190c0b7c0a3234730f7ef0aeb080a7 Mon Sep 17 00:00:00 2001 From: danbugs Date: Wed, 6 Nov 2024 22:31:34 +0000 Subject: [PATCH 1/2] Adressing feedback from upstream sync - clarified comment on `topic` function. - added portability comment onto `metadata` to avoid it being used as an escape-hatch. - removed `get-topics` func in favour of using wasi-config for runtime configuration. --- wit/guest.wit | 6 ------ wit/types.wit | 5 +++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/wit/guest.wit b/wit/guest.wit index 29c916d..73cfc72 100644 --- a/wit/guest.wit +++ b/wit/guest.wit @@ -6,10 +6,4 @@ interface incoming-handler { /// message accordingly. Implementors (such as hosts) calling this interface should make their /// own decisions on how to handle errors returned from this function. handle: func(message: message) -> result<_, error>; - - // Returns a list of topics (represented as `string`s) at runtime the guest should be subscribed - // Implementors should consider also allowing subscriptions to be made at compile time - // via some sort of configuration file. This function is intended to be called at the start of the - // guest's lifecycle before any messages are sent. - get-topics: func() -> result, error>; } diff --git a/wit/types.wit b/wit/types.wit index 5c0b417..d7e8292 100644 --- a/wit/types.wit +++ b/wit/types.wit @@ -26,7 +26,7 @@ interface types { /// A message with a binary payload and additional information resource message { constructor(data: list); - /// The topic/subject/channel this message was received or should be sent on + /// The topic/subject/channel this message was received on topic: func() -> topic; /// An optional content-type describing the format of the data in the message. This is /// sometimes described as the "format" type @@ -39,7 +39,8 @@ interface types { /// Set the opaque blob of data for this message, discarding the old value set-data: func(data: list); /// Optional metadata (also called headers or attributes in some systems) attached to the - /// message + /// message. This metadata is simply decoration and should not be interpreted by a host + /// to ensure portability across different implementors (e.g., Kafka -> NATS, etc.). metadata: func() -> option; /// Add a new key-value pair to the metadata, overwriting any existing value for the same key add-metadata: func(key: string, value: string); From d9fd26f32c6941d45933a8ecbd2b359ae981a60f Mon Sep 17 00:00:00 2001 From: danbugs Date: Wed, 6 Nov 2024 22:33:48 +0000 Subject: [PATCH 2/2] [chore] update markdown files Signed-off-by: danbugs --- imports-request-reply.md | 5 +++-- imports.md | 5 +++-- messaging-core.md | 14 +++----------- messaging-request-reply.md | 14 +++----------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/imports-request-reply.md b/imports-request-reply.md index 36f7f59..d36307e 100644 --- a/imports-request-reply.md +++ b/imports-request-reply.md @@ -73,7 +73,7 @@ This allows the component to perform request/reply messaging patterns.

  • own<message>
  • [method]message.topic: func

    -

    The topic/subject/channel this message was received or should be sent on

    +

    The topic/subject/channel this message was received on

    Params
    • self: borrow<message>
    • @@ -120,7 +120,8 @@ sometimes described as the "format" type

    [method]message.metadata: func

    Optional metadata (also called headers or attributes in some systems) attached to the -message

    +message. This metadata is simply decoration and should not be interpreted by a host +to ensure portability across different implementors (e.g., Kafka -> NATS, etc.).

    Params
    • self: borrow<message>
    • diff --git a/imports.md b/imports.md index 6f19354..2900330 100644 --- a/imports.md +++ b/imports.md @@ -72,7 +72,7 @@ It includes the producer interface for sending messages.

    • own<message>

    [method]message.topic: func

    -

    The topic/subject/channel this message was received or should be sent on

    +

    The topic/subject/channel this message was received on

    Params
    • self: borrow<message>
    • @@ -119,7 +119,8 @@ sometimes described as the "format" type

    [method]message.metadata: func

    Optional metadata (also called headers or attributes in some systems) attached to the -message

    +message. This metadata is simply decoration and should not be interpreted by a host +to ensure portability across different implementors (e.g., Kafka -> NATS, etc.).

    Params
    • self: borrow<message>
    • diff --git a/messaging-core.md b/messaging-core.md index 65b3433..1302613 100644 --- a/messaging-core.md +++ b/messaging-core.md @@ -77,7 +77,7 @@ enabling the component to handle incoming messages without request/reply capabil
    • own<message>

    [method]message.topic: func

    -

    The topic/subject/channel this message was received or should be sent on

    +

    The topic/subject/channel this message was received on

    Params
    • self: borrow<message>
    • @@ -124,7 +124,8 @@ sometimes described as the "format" type

    [method]message.metadata: func

    Optional metadata (also called headers or attributes in some systems) attached to the -message

    +message. This metadata is simply decoration and should not be interpreted by a host +to ensure portability across different implementors (e.g., Kafka -> NATS, etc.).

    Params
    • self: borrow<message>
    • @@ -212,12 +213,3 @@ own decisions on how to handle errors returned from this function.

      -

      get-topics: func

      -

      Returns a list of topics (represented as strings) at runtime the guest should be subscribed -Implementors should consider also allowing subscriptions to be made at compile time -via some sort of configuration file. This function is intended to be called at the start of the -guest's lifecycle before any messages are sent.

      -
      Return values
      - diff --git a/messaging-request-reply.md b/messaging-request-reply.md index b1c5f75..37d61c0 100644 --- a/messaging-request-reply.md +++ b/messaging-request-reply.md @@ -79,7 +79,7 @@ handling incoming messages with request/reply capabilities.

    • own<message>

    [method]message.topic: func

    -

    The topic/subject/channel this message was received or should be sent on

    +

    The topic/subject/channel this message was received on

    Params
    • self: borrow<message>
    • @@ -126,7 +126,8 @@ sometimes described as the "format" type

    [method]message.metadata: func

    Optional metadata (also called headers or attributes in some systems) attached to the -message

    +message. This metadata is simply decoration and should not be interpreted by a host +to ensure portability across different implementors (e.g., Kafka -> NATS, etc.).

    Params
    • self: borrow<message>
    • @@ -296,12 +297,3 @@ own decisions on how to handle errors returned from this function.

      -

      get-topics: func

      -

      Returns a list of topics (represented as strings) at runtime the guest should be subscribed -Implementors should consider also allowing subscriptions to be made at compile time -via some sort of configuration file. This function is intended to be called at the start of the -guest's lifecycle before any messages are sent.

      -
      Return values
      -