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 @@ +
wasi:messaging/types@0.2.0-draft
wasi:messaging/request-reply@0.2.0-draft
wasi:messaging/producer@0.2.0-draft
wasi:messaging/consumer@0.2.0-draft
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.).
+channels
: list<channel
>extensions
: option<list<(string
, string
)>>record message
A message with a binary payload and additional information
+The topic or subject this message was received or should be sent on +
An optional content-type describing the format of the data in the message. This is +sometimes described as the "format" type +
An optional topic for use in request/response scenarios. Senders and consumers of +messages must not assume that this field is set and should handle it in their code +accordingly. +
An opaque blob of data +
metadata
: option<list<(string
, string
)>>
Optional metadata (also called headers or attributes in some systems) attached to the message +
[static]client.connect: func
[static]error.trace: func
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.
+type client
+#### `type message` +[`message`](#message) +
+#### `type error` +[`error`](#error) +
+---- +
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.
The producer interface is uesed to send messages to a channel/topic.
+type client
+#### `type channel` +[`channel`](#channel) +
+#### `type message` +[`message`](#message) +
+#### `type error` +[`error`](#error) +
+---- +
send: func
Sends a message to the given channel/topic. This topic can be overridden if a message has a +non-empty topic field
+error
>>The consumer interface allows a guest to dynamically update its subscriptions and configuration +as well as functionality for completing (acking) or abandoning (nacking) messages.
+type client
+#### `type message` +[`message`](#message) +
+#### `type channel` +[`channel`](#channel) +
+#### `type error` +[`error`](#error) +
+#### `type guest-configuration` +[`guest-configuration`](#guest_configuration) +
+---- +
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.
gc
: guest-configuration
error
>>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:
+m
: message
error
>>abandon-message: func
m
: message
error
>>wasi:messaging/messaging-types@0.2.0-draft
wasi:messaging/types@0.2.0-draft
wasi:messaging/producer@0.2.0-draft
wasi:messaging/consumer@0.2.0-draft
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
-record message
A message with a binary payload, a format specification, and decorative metadata.
+A message with a binary payload and additional information
data
: list<u8
>format
: format-spec
metadata
: option<list<(string
, string
)>>The topic or subject this message was received or should be sent on +
An optional content-type describing the format of the data in the message. This is +sometimes described as the "format" type +
An optional topic for use in request/response scenarios. Senders and consumers of +messages must not assume that this field is set and should handle it in their code +accordingly. +
An opaque blob of data +
metadata
: option<list<(string
, string
)>>
Optional metadata (also called headers or attributes in some systems) attached to the message +
string
The producer interface is uesed to send messages to a channel/topic.
type client
send: func
Sends a message to the given channel/topic. This topic can be overridden if a message has a +non-empty topic field
The consumer interface allows a guest to dynamically update its subscriptions and configuration +as well as functionality for completing (acking) or abandoning (nacking) messages.
type client
----
subscribe-try-receive: func
Blocking receive for t-milliseconds with ephemeral subscription – if no message is received, returns None
-subscribe-receive: func
Blocking receive until message with ephemeral subscription
-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.
gc
: guest-configuration
wasi:messaging/messaging-types@0.2.0-draft
wasi:messaging/types@0.2.0-draft
wasi:messaging/producer@0.2.0-draft
wasi:messaging/consumer@0.2.0-draft
wasi:messaging/messaging-guest@0.2.0-draft
wasi:messaging/guest@0.2.0-draft
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: @@ -34,28 +35,33 @@
channels
: list<channel
>extensions
: option<list<(string
, string
)>>enum format-spec
Format specification for messages
-record message
A message with a binary payload, a format specification, and decorative metadata.
+A message with a binary payload and additional information
data
: list<u8
>format
: format-spec
metadata
: option<list<(string
, string
)>>The topic or subject this message was received or should be sent on +
An optional content-type describing the format of the data in the message. This is +sometimes described as the "format" type +
An optional topic for use in request/response scenarios. Senders and consumers of +messages must not assume that this field is set and should handle it in their code +accordingly. +
An opaque blob of data +
metadata
: option<list<(string
, string
)>>
Optional metadata (also called headers or attributes in some systems) attached to the message +
string
The producer interface is uesed to send messages to a channel/topic.
type client
send: func
Sends a message to the given channel/topic. This topic can be overridden if a message has a +non-empty topic field
The consumer interface allows a guest to dynamically update its subscriptions and configuration +as well as functionality for completing (acking) or abandoning (nacking) messages.
type client
----
subscribe-try-receive: func
Blocking receive for t-milliseconds with ephemeral subscription – if no message is received, returns None
-subscribe-receive: func
Blocking receive until message with ephemeral subscription
-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.
gc
: guest-configuration
error
>>type message
----
configure: func
Returns the list of channels (and extension metadata within guest-configuration) that -this component should subscribe to and be handled by the subsequent handler within guest-configuration
-guest-configuration
, own<error
>>handler: func
Whenever this guest receives a message in one of the subscribed channels, the message is sent to this handler
+Whenever this guest receives a message in one of the subscribed channels, the message is +sent to this handler
ms
: list<message
>