22
22
<p ><a name =" error.unauthorized " ></a ><code >unauthorized</code ></p >
23
23
<p >The requested option is not authorized. This could be a topic it doesn't have
24
24
permission to subscribe to, or a permission it doesn't have to perform a specific
25
- action. This error is mainly used when calling ` update-config ` .
25
+ action. This error is mainly used when calling ` set-subscriptions ` on a guest .
26
26
</li >
27
27
<li >
28
28
<p ><a name =" error.timeout " ></a ><code >timeout</code ></p >
@@ -33,22 +33,14 @@ action. This error is mainly used when calling `update-config`.
33
33
<p >An error occurred with the connection. Includes a message for additional context
34
34
</li >
35
35
<li >
36
+ <p ><a name =" error.abandoned " ></a ><code >abandoned</code >: <code >string</code ></p >
37
+ <p >Work on the message was abandoned for the given reason
38
+ </li >
39
+ <li >
36
40
<p ><a name =" error.other " ></a ><code >other</code >: <code >string</code ></p >
37
41
<p >A catch all for other types of errors
38
42
</li >
39
43
</ul >
40
- <h4 ><a name =" channel " ></a ><code >type channel</code ></h4 >
41
- <p ><code >string</code ></p >
42
- <p >There are two types of channels:
43
- - publish-subscribe channel, which is a broadcast channel, and
44
- - point-to-point channel, which is a unicast channel.
45
- <p >The interface doesn't highlight this difference in the type itself as that's uniquely a consumer issue.</p >
46
- <h4 ><a name =" config " ></a ><code >record config</code ></h4 >
47
- <p >Configuration includes a required list of channels the guest is subscribing to</p >
48
- <h5 >Record Fields</h5 >
49
- <ul >
50
- <li ><a name =" config.channels " ></a ><code >channels</code >: list< ; <a href =" #channel " ><a href =" #channel " ><code >channel</code ></a ></a >> ; </li >
51
- </ul >
52
44
<h4 ><a name =" message " ></a ><code >resource message</code ></h4 >
53
45
<h2 >A message with a binary payload and additional information</h2 >
54
46
<h3 >Functions</h3 >
@@ -64,10 +56,8 @@ action. This error is mainly used when calling `update-config`.
64
56
<h4 ><a name =" constructor_message " ></a ><code >[constructor]message: func</code ></h4 >
65
57
<h5 >Params</h5 >
66
58
<ul >
67
- <li ><a name =" constructor_message.topic " ></a ><code >topic</code >: <a href = " #channel " >< a href = " #channel " >< code >channel </code ></ a ></ a ></li >
59
+ <li ><a name =" constructor_message.topic " ></a ><code >topic</code >: <code >string </code ></li >
68
60
<li ><a name =" constructor_message.data " ></a ><code >data</code >: list< ; <code >u8</code >> ; </li >
69
- <li ><a name =" constructor_message.content_type " ></a ><code >content-type</code >: option< ; <code >string</code >> ; </li >
70
- <li ><a name =" constructor_message.metadata " ></a ><code >metadata</code >: option< ; list< ; (<code >string</code >, <code >string</code >)> ;> ; </li >
71
61
</ul >
72
62
<h5 >Return values</h5 >
73
63
<ul >
@@ -81,14 +71,14 @@ action. This error is mainly used when calling `update-config`.
81
71
</ul >
82
72
<h5 >Return values</h5 >
83
73
<ul >
84
- <li ><a name =" method_message.topic.0 " ></a > <a href = " #channel " >< a href = " #channel " >< code >channel </code ></ a ></ a ></li >
74
+ <li ><a name =" method_message.topic.0 " ></a > <code >string </code ></li >
85
75
</ul >
86
76
<h4 ><a name =" method_message.set_topic " ></a ><code >[method]message.set-topic: func</code ></h4 >
87
77
<p >Set the topic/subject/channel this message should be sent on</p >
88
78
<h5 >Params</h5 >
89
79
<ul >
90
80
<li ><a name =" method_message.set_topic.self " ></a ><code >self</code >: borrow< ; <a href =" #message " ><a href =" #message " ><code >message</code ></a ></a >> ; </li >
91
- <li ><a name =" method_message.set_topic.topic " ></a ><code >topic</code >: <a href = " #channel " >< a href = " #channel " >< code >channel </code ></ a ></ a ></li >
81
+ <li ><a name =" method_message.set_topic.topic " ></a ><code >topic</code >: <code >string </code ></li >
92
82
</ul >
93
83
<h4 ><a name =" method_message.content_type " ></a ><code >[method]message.content-type: func</code ></h4 >
94
84
<p >An optional content-type describing the format of the data in the message. This is
@@ -145,46 +135,6 @@ message</p>
145
135
<li ><a name =" method_message.add_metadata.key " ></a ><code >key</code >: <code >string</code ></li >
146
136
<li ><a name =" method_message.add_metadata.value " ></a ><code >value</code >: <code >string</code ></li >
147
137
</ul >
148
- <h4 ><a name =" method_message.complete " ></a ><code >[method]message.complete: func</code ></h4 >
149
- <p >Completes/acks the message</p >
150
- <p >A message can exist under several statuses:
151
- (1) available: the message is ready to be read,
152
- (2) acquired: the message has been sent to a consumer (but still exists in the queue),
153
- (3) accepted (result of complete): the message has been received and ACK-ed by a consumer and can be safely removed from the queue,
154
- (4) rejected (result of abandon): the message has been received and NACK-ed by a consumer, at which point it can be:</p >
155
- <ul >
156
- <li >deleted,</li >
157
- <li >sent to a dead-letter queue, or</li >
158
- <li >kept in the queue for further processing.</li >
159
- </ul >
160
- <h5 >Params</h5 >
161
- <ul >
162
- <li ><a name =" method_message.complete.self " ></a ><code >self</code >: borrow< ; <a href =" #message " ><a href =" #message " ><code >message</code ></a ></a >> ; </li >
163
- </ul >
164
- <h5 >Return values</h5 >
165
- <ul >
166
- <li ><a name =" method_message.complete.0 " ></a > result< ; _, <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ; </li >
167
- </ul >
168
- <h4 ><a name =" method_message.abandon " ></a ><code >[method]message.abandon: func</code ></h4 >
169
- <p >Abandon/nacks the message</p >
170
- <p >A message can exist under several statuses:
171
- (1) available: the message is ready to be read,
172
- (2) acquired: the message has been sent to a consumer (but still exists in the queue),
173
- (3) accepted (result of complete): the message has been received and ACK-ed by a consumer and can be safely removed from the queue,
174
- (4) rejected (result of abandon): the message has been received and NACK-ed by a consumer, at which point it can be:</p >
175
- <ul >
176
- <li >deleted,</li >
177
- <li >sent to a dead-letter queue, or</li >
178
- <li >kept in the queue for further processing.</li >
179
- </ul >
180
- <h5 >Params</h5 >
181
- <ul >
182
- <li ><a name =" method_message.abandon.self " ></a ><code >self</code >: borrow< ; <a href =" #message " ><a href =" #message " ><code >message</code ></a ></a >> ; </li >
183
- </ul >
184
- <h5 >Return values</h5 >
185
- <ul >
186
- <li ><a name =" method_message.abandon.0 " ></a > result< ; _, <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ; </li >
187
- </ul >
188
138
<
h2 ><
a name =
" wasi:messaging_request_reply_0.2.0_draft " ></
a >Import interface wasi:messaging/
[email protected] </
h2 >
189
139
<p >The request-reply interface allows a guest to send a message and await a response. This
190
140
interface is considered optional as not all message services support the concept of
@@ -201,20 +151,53 @@ included it as a core interface.</p>
201
151
#### <a name =" error " ></a >` type error `
202
152
[ ` error ` ] ( #error )
203
153
<p >
204
- ----
154
+ #### <a name =" request_options " ></a >` resource request-options `
155
+ <h2 >Options for a request/reply operation. This is a resource to allow for future expansion of
156
+ options.</h2 >
205
157
<h3 >Functions</h3 >
158
+ <h4 ><a name =" constructor_request_options " ></a ><code >[constructor]request-options: func</code ></h4 >
159
+ <p >Creates a new request options resource with no options set.</p >
160
+ <h5 >Return values</h5 >
161
+ <ul >
162
+ <li ><a name =" constructor_request_options.0 " ></a > own< ; <a href =" #request_options " ><a href =" #request_options " ><code >request-options</code ></a ></a >> ; </li >
163
+ </ul >
164
+ <h4 ><a name =" method_request_options.set_timeout_ms " ></a ><code >[method]request-options.set-timeout-ms: func</code ></h4 >
165
+ <p >The maximum amount of time to wait for a response. If the timeout value is not set, then
166
+ the request/reply operation will block until a message is received in response.</p >
167
+ <h5 >Params</h5 >
168
+ <ul >
169
+ <li ><a name =" method_request_options.set_timeout_ms.self " ></a ><code >self</code >: borrow< ; <a href =" #request_options " ><a href =" #request_options " ><code >request-options</code ></a ></a >> ; </li >
170
+ <li ><a name =" method_request_options.set_timeout_ms.timeout_ms " ></a ><code >timeout-ms</code >: <code >u32</code ></li >
171
+ </ul >
206
172
<h4 ><a name =" request " ></a ><code >request: func</code ></h4 >
207
- <p >Performs a blocking request/reply operation with an optional timeout. If the timeout value
208
- is not set, then the request/reply operation will block indefinitely.</p >
173
+ <p >Performs a blocking request/reply operation with an optional set of request options. This
174
+ returns only the first reply received or a timeout . If more than one reply is expected, then the
175
+ <a href =" #request_multi " ><code >request-multi</code ></a > function should be used instead.</p >
209
176
<h5 >Params</h5 >
210
177
<ul >
211
- <li ><a name =" request.c " ></a ><code >c</code >: own < ; <a href =" #client " ><a href =" #client " ><code >client</code ></a ></a >> ; </li >
178
+ <li ><a name =" request.c " ></a ><code >c</code >: borrow < ; <a href =" #client " ><a href =" #client " ><code >client</code ></a ></a >> ; </li >
212
179
<li ><a name =" request.msg " ></a ><code >msg</code >: own< ; <a href =" #message " ><a href =" #message " ><code >message</code ></a ></a >> ; </li >
213
- <li ><a name =" request.timeout_ms " ></a ><code >timeout-ms</code >: option< ; <code >u32</code >> ; </li >
180
+ <li ><a name =" request.opts " ></a ><code >opts</code >: option< ; own< ; <a href =" #request_options " ><a href =" #request_options " ><code >request-options</code ></a ></a >> ;> ; </li >
181
+ </ul >
182
+ <h5 >Return values</h5 >
183
+ <ul >
184
+ <li ><a name =" request.0 " ></a > result< ; own< ; <a href =" #message " ><a href =" #message " ><code >message</code ></a ></a >> ; , <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ; </li >
185
+ </ul >
186
+ <h4 ><a name =" request_multi " ></a ><code >request-multi: func</code ></h4 >
187
+ <p >Performs a blocking request/reply operation with an optional set of request options. This
188
+ returns all replies received up to the number of expected replies. It is recommended to use
189
+ a <a href =" #request_options " ><code >request-options</code ></a > with the timeout set to ensure that the operation does not block
190
+ indefinitely.</p >
191
+ <h5 >Params</h5 >
192
+ <ul >
193
+ <li ><a name =" request_multi.c " ></a ><code >c</code >: borrow< ; <a href =" #client " ><a href =" #client " ><code >client</code ></a ></a >> ; </li >
194
+ <li ><a name =" request_multi.msg " ></a ><code >msg</code >: own< ; <a href =" #message " ><a href =" #message " ><code >message</code ></a ></a >> ; </li >
195
+ <li ><a name =" request_multi.expected_replies " ></a ><code >expected-replies</code >: <code >u32</code ></li >
196
+ <li ><a name =" request_multi.opts " ></a ><code >opts</code >: option< ; own< ; <a href =" #request_options " ><a href =" #request_options " ><code >request-options</code ></a ></a >> ;> ; </li >
214
197
</ul >
215
198
<h5 >Return values</h5 >
216
199
<ul >
217
- <li ><a name =" request .0" ></a > result< ; option & lt ; list< ; own< ; <a href =" #message " ><a href =" #message " ><code >message</code ></a ></a >& gt ; > ;> ; , <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ; </li >
200
+ <li ><a name =" request_multi .0" ></a > result< ; list< ; own< ; <a href =" #message " ><a href =" #message " ><code >message</code ></a ></a >> ;> ; , <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ; </li >
218
201
</ul >
219
202
<h4 ><a name =" reply " ></a ><code >reply: func</code ></h4 >
220
203
<p >Replies to the given message with the given response message. The details of which channel
@@ -236,9 +219,6 @@ handled in the best way possible for the underlying messaging system.</p>
236
219
<h4 ><a name =" client " ></a ><code >type client</code ></h4 >
237
220
<p ><a href =" #client " ><a href =" #client " ><code >client</code ></a ></a ></p >
238
221
<p >
239
- #### <a name =" channel " ></a >` type channel `
240
- [ ` channel ` ] ( #channel )
241
- <p >
242
222
#### <a name =" message " ></a >` type message `
243
223
[ ` message ` ] ( #message )
244
224
<p >
@@ -248,12 +228,10 @@ handled in the best way possible for the underlying messaging system.</p>
248
228
----
249
229
<h3 >Functions</h3 >
250
230
<h4 ><a name =" send " ></a ><code >send: func</code ></h4 >
251
- <p >Sends a message to the given channel/topic. If the channel/topic is not empty, it will
252
- override the channel/topic in the message.</p >
231
+ <p >Sends the message using the given client.</p >
253
232
<h5 >Params</h5 >
254
233
<ul >
255
234
<li ><a name =" send.c " ></a ><code >c</code >: own< ; <a href =" #client " ><a href =" #client " ><code >client</code ></a ></a >> ; </li >
256
- <li ><a name =" send.ch " ></a ><code >ch</code >: <a href =" #channel " ><a href =" #channel " ><code >channel</code ></a ></a ></li >
257
235
<li ><a name =" send.m " ></a ><code >m</code >: own< ; <a href =" #message " ><a href =" #message " ><code >message</code ></a ></a >> ; </li >
258
236
</ul >
259
237
<h5 >Return values</h5 >
@@ -267,18 +245,10 @@ override the channel/topic in the message.</p>
267
245
<h4 ><a name =" error " ></a ><code >type error</code ></h4 >
268
246
<p ><a href =" #error " ><a href =" #error " ><code >error</code ></a ></a ></p >
269
247
<p >
270
- #### <a name =" config " ></a >` type config `
271
- [ ` config ` ] ( #config )
272
- <p >
273
248
----
274
249
<h3 >Functions</h3 >
275
- <h4 ><a name =" update_config " ></a ><code >update-config: func</code ></h4 >
276
- <p >'Fit-all' type function for updating a guest's configuration – this could be useful for:</p >
277
- <ul >
278
- <li >unsubscribing from a channel,</li >
279
- <li >checkpointing,</li >
280
- <li >etc..</li >
281
- </ul >
250
+ <h4 ><a name =" set_subscriptions " ></a ><code >set-subscriptions: func</code ></h4 >
251
+ <p >Set the current subscriptions for this guest.</p >
282
252
<p >Please note that implementations that provide <code >wasi:messaging</code > are responsible for ensuring
283
253
that guests are not allowed to subscribe to channels that they are not configured to
284
254
subscribe to (or have access to). Failure to do so can result in possible breakout or access
@@ -287,9 +257,9 @@ should validate that the configured topics are valid topics the guest should hav
287
257
enforce it via the credentials used to connect to the service.</p >
288
258
<h5 >Params</h5 >
289
259
<ul >
290
- <li ><a name =" update_config.gc " ></a ><code >gc </code >: < a href = " #config " >< a href = " #config " >< code >config </code ></ a ></ a > </li >
260
+ <li ><a name =" set_subscriptions.topics " ></a ><code >topics </code >: list & lt ; < code >string </code >& gt ; </li >
291
261
</ul >
292
262
<h5 >Return values</h5 >
293
263
<ul >
294
- <li ><a name =" update_config .0" ></a > result< ; _, <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ; </li >
264
+ <li ><a name =" set_subscriptions .0" ></a > result< ; _, <a href =" #error " ><a href =" #error " ><code >error</code ></a ></a >> ; </li >
295
265
</ul >
0 commit comments