- Imports:
- interface
wasi:messaging/[email protected]
- interface
wasi:messaging/[email protected]
- interface
- Exports:
- interface
wasi:messaging/[email protected]
- interface
Import interface wasi:messaging/[email protected]
A connection to a message-exchange service (e.g., buffer, broker, etc.).
Errors that can occur when using the messaging interface.
-
The request or operation timed out.
-
An error occurred with the connection. Includes a message for additional context
-
A catch all for other types of errors
- own<
message
>
The topic/subject/channel this message was received or should be sent on
self
: borrow<message
>
Set the topic/subject/channel this message should be sent on
self
: borrow<message
>topic
:string
An optional content-type describing the format of the data in the message. This is sometimes described as the "format" type
self
: borrow<message
>
Set the content-type describing the format of the data in the message. This is sometimes described as the "format" type
self
: borrow<message
>content-type
:string
An opaque blob of data
self
: borrow<message
>
Set the opaque blob of data for this message, discarding the old value
self
: borrow<message
>data
: list<u8
>
Optional metadata (also called headers or attributes in some systems) attached to the message
self
: borrow<message
>
Add a new key-value pair to the metadata, overwriting any existing value for the same key
self
: borrow<message
>key
:string
value
:string
Import interface wasi:messaging/[email protected]
The producer interface is used to send messages to a channel/topic.
#### `type message` [`message`](#message)
#### `type error` [`error`](#error)
----
Sends the message using the given client.
- result<_,
error
>
Export interface wasi:messaging/[email protected]
#### `type error` [`error`](#error)
----
Whenever this guest receives a message in one of the subscribed channels, the message is sent to this handler. The guest is responsible for matching on the channel and handling the message accordingly. Implementors (such as hosts) calling this interface should make their own decisions on how to handle errors returned from this function.
ms
: own<message
>
- result<_,
error
>
Subscribe to a list of topics (represented as string
s) at runtime.
Implementors should consider also allowing subscriptions to be made at compile time via
some sort of configuration file.
- result<list<
string
>,error
>