diff --git a/imports-request-reply.md b/imports-request-reply.md new file mode 100644 index 0000000..be3624e --- /dev/null +++ b/imports-request-reply.md @@ -0,0 +1,216 @@ +

World imports-request-reply

+ +

Import interface wasi:messaging/types@0.2.0-draft

+
+

Types

+

resource client

+

A connection to a message-exchange service (e.g., buffer, broker, etc.).

+

resource error

+

TODO(danbugs): This should be eventually extracted as an underlying type for other +wasi-cloud-core interfaces.

+

type channel

+

string

+

There are two types of channels: +- publish-subscribe channel, which is a broadcast channel, and +- point-to-point channel, which is a unicast channel. +

The interface doesn't highlight this difference in the type itself as that's uniquely a consumer issue.

+

record guest-configuration

+

Configuration includes a required list of channels the guest is subscribing to, and an optional list of extensions key-value pairs +(e.g., partitions/offsets to read from in Kafka/EventHubs, QoS etc.).

+
Record Fields
+ +

record message

+

A message with a binary payload and additional information

+
Record Fields
+ +
+

Functions

+

[static]client.connect: func

+
Params
+ +
Return values
+ +

[static]error.trace: func

+
Return values
+ +

Import interface wasi:messaging/request-reply@0.2.0-draft

+

The request-reply interface allows a guest to send a message and await a response. This +interface is considered optional as not all message services support the concept of +request/reply. However, request/reply is a very common pattern in messaging and as such, we have +included it as a core interface.

+
+

Types

+

type client

+

client

+

+#### `type message` +[`message`](#message) +

+#### `type error` +[`error`](#error) +

+---- +

Functions

+

request: func

+

Performs a blocking request/reply operation with an optional timeout. If the timeout value +is not set, then the request/reply operation will block indefinitely.

+

Please note that implementations that provide wasi:messaging are responsible for ensuring +that guests are not allowed to subscribe to channels that they are not configured to +subscribe to (or have access to). Failure to do so can result in possible breakout or access +to resources that are not intended to be accessible to the guest. This means implementations +should validate that the reply-to field is a valid topic the guest should have access to or +enforce it via the credentials used to connect to the service.

+
Params
+ +
Return values
+ +

Import interface wasi:messaging/producer@0.2.0-draft

+

The producer interface is uesed to send messages to a channel/topic.

+
+

Types

+

type client

+

client

+

+#### `type channel` +[`channel`](#channel) +

+#### `type message` +[`message`](#message) +

+#### `type error` +[`error`](#error) +

+---- +

Functions

+

send: func

+

Sends a message to the given channel/topic. This topic can be overridden if a message has a +non-empty topic field

+
Params
+ +
Return values
+ +

Import interface wasi:messaging/consumer@0.2.0-draft

+

The consumer interface allows a guest to dynamically update its subscriptions and configuration +as well as functionality for completing (acking) or abandoning (nacking) messages.

+
+

Types

+

type client

+

client

+

+#### `type message` +[`message`](#message) +

+#### `type channel` +[`channel`](#channel) +

+#### `type error` +[`error`](#error) +

+#### `type guest-configuration` +[`guest-configuration`](#guest_configuration) +

+---- +

Functions

+

update-guest-configuration: func

+

'Fit-all' type function for updating a guest's configuration – this could be useful for:

+ +

Please note that implementations that provide wasi:messaging are responsible for ensuring +that guests are not allowed to subscribe to channels that they are not configured to +subscribe to (or have access to). Failure to do so can result in possible breakout or access +to resources that are not intended to be accessible to the guest. This means implementations +should validate that the configured topix are valid topics the guest should have access to or +enforce it via the credentials used to connect to the service.

+
Params
+ +
Return values
+ +

complete-message: func

+

A message can exist under several statuses: +(1) available: the message is ready to be read, +(2) acquired: the message has been sent to a consumer (but still exists in the queue), +(3) accepted (result of complete-message): the message has been received and ACK-ed by a consumer and can be safely removed from the queue, +(4) rejected (result of abandon-message): the message has been received and NACK-ed by a consumer, at which point it can be:

+ +
Params
+ +
Return values
+ +

abandon-message: func

+
Params
+ +
Return values
+ diff --git a/imports.md b/imports.md index cc4b825..08ea482 100644 --- a/imports.md +++ b/imports.md @@ -2,19 +2,20 @@ -

Import interface wasi:messaging/messaging-types@0.2.0-draft

+

Import interface wasi:messaging/types@0.2.0-draft


Types

resource client

A connection to a message-exchange service (e.g., buffer, broker, etc.).

resource error

-

TODO(danbugs): This should be eventually extracted as an underlying type for other wasi-cloud-core interfaces.

+

TODO(danbugs): This should be eventually extracted as an underlying type for other +wasi-cloud-core interfaces.

type channel

string

There are two types of channels: @@ -29,28 +30,33 @@

  • channels: list<channel>
  • extensions: option<list<(string, string)>>
  • -

    enum format-spec

    -

    Format specification for messages

    - -
    Enum Cases
    -

    record message

    -

    A message with a binary payload, a format specification, and decorative metadata.

    +

    A message with a binary payload and additional information

    Record Fields

    Functions

    @@ -69,6 +75,7 @@
  • string
  • Import interface wasi:messaging/producer@0.2.0-draft

    +

    The producer interface is uesed to send messages to a channel/topic.


    Types

    type client

    @@ -86,6 +93,8 @@ ----

    Functions

    send: func

    +

    Sends a message to the given channel/topic. This topic can be overridden if a message has a +non-empty topic field

    Params

    Import interface wasi:messaging/consumer@0.2.0-draft

    +

    The consumer interface allows a guest to dynamically update its subscriptions and configuration +as well as functionality for completing (acking) or abandoning (nacking) messages.


    Types

    type client

    @@ -116,29 +127,6 @@

    ----

    Functions

    -

    subscribe-try-receive: func

    -

    Blocking receive for t-milliseconds with ephemeral subscription – if no message is received, returns None

    -
    Params
    - -
    Return values
    - -

    subscribe-receive: func

    -

    Blocking receive until message with ephemeral subscription

    -
    Params
    - -
    Return values
    -

    update-guest-configuration: func

    'Fit-all' type function for updating a guest's configuration – this could be useful for:

    +

    Please note that implementations that provide wasi:messaging are responsible for ensuring +that guests are not allowed to subscribe to channels that they are not configured to +subscribe to (or have access to). Failure to do so can result in possible breakout or access +to resources that are not intended to be accessible to the guest. This means implementations +should validate that the configured topix are valid topics the guest should have access to or +enforce it via the credentials used to connect to the service.

    Params
    -

    enum format-spec

    -

    Format specification for messages

    - -
    Enum Cases
    -

    record message

    -

    A message with a binary payload, a format specification, and decorative metadata.

    +

    A message with a binary payload and additional information

    Record Fields

    Functions

    @@ -74,6 +80,7 @@
  • string
  • Import interface wasi:messaging/producer@0.2.0-draft

    +

    The producer interface is uesed to send messages to a channel/topic.


    Types

    type client

    @@ -91,6 +98,8 @@ ----

    Functions

    send: func

    +

    Sends a message to the given channel/topic. This topic can be overridden if a message has a +non-empty topic field

    Params

    Import interface wasi:messaging/consumer@0.2.0-draft

    +

    The consumer interface allows a guest to dynamically update its subscriptions and configuration +as well as functionality for completing (acking) or abandoning (nacking) messages.


    Types

    type client

    @@ -121,29 +132,6 @@

    ----

    Functions

    -

    subscribe-try-receive: func

    -

    Blocking receive for t-milliseconds with ephemeral subscription – if no message is received, returns None

    -
    Params
    - -
    Return values
    - -

    subscribe-receive: func

    -

    Blocking receive until message with ephemeral subscription

    -
    Params
    - -
    Return values
    -

    update-guest-configuration: func

    'Fit-all' type function for updating a guest's configuration – this could be useful for:

    +

    Please note that implementations that provide wasi:messaging are responsible for ensuring +that guests are not allowed to subscribe to channels that they are not configured to +subscribe to (or have access to). Failure to do so can result in possible breakout or access +to resources that are not intended to be accessible to the guest. This means implementations +should validate that the configured topix are valid topics the guest should have access to or +enforce it via the credentials used to connect to the service.

    Params