The imports
world defines the interfaces that the component will import from the host.
It includes the producer
interface for sending messages.
- Imports:
- interface
wasi:messaging/[email protected]
- interface
wasi:messaging/[email protected]
- interface
Import interface wasi:messaging/[email protected]
A type alias for list> to represent metadata attached to a message
string
A type alias for string to represent a message topic
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 permission error occurred. Includes a message for additional context
-
A catch all for other types of errors
self
: borrow<client
>
- result<_,
error
>
- own<
message
>
The topic/subject/channel this message was received on
self
: borrow<message
>
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. This metadata is simply decoration and should not be interpreted by a host to ensure portability across different implementors (e.g., Kafka -> NATS, etc.).
self
: borrow<message
>
- option<
metadata
>
Add a new key-value pair to the metadata, overwriting any existing value for the same key
self
: borrow<message
>key
:string
value
:string
Set the metadata
Remove a key-value pair from the metadata
self
: borrow<message
>key
: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)
#### `type topic` [`topic`](#topic)
----
Sends the message using the given client.
- result<_,
error
>