You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/queues/configuration/javascript-apis.mdx
+21-18Lines changed: 21 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,8 @@ head:
9
9
10
10
---
11
11
12
+
import { Type } from"~/components";
13
+
12
14
Cloudflare Queues is integrated with [Cloudflare Workers](/workers). To send and receive messages, you must use a Worker.
13
15
14
16
A Worker that can send messages to a Queue is a producer Worker, while a Worker that can receive messages from a Queue is a consumer Worker. It is possible for the same Worker to be a producer and consumer, if desired.
* Sends a message to the Queue. The body can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB.
68
70
* When the promise resolves, the message is confirmed to be written to disk.
* Sends a batch of messages to the Queue. Each item in the provided [Iterable](https://www.typescriptlang.org/docs/handbook/iterators-and-generators.html) must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB.
73
75
* When the promise resolves, the messages are confirmed to be written to disk.
@@ -87,12 +89,12 @@ type MessageSendRequest<Body = unknown> = {
87
89
88
90
89
91
90
-
* <code>body</code> unknown
92
+
* <code>body</code> <Typetext="unknown" />
91
93
92
94
* The body of the message.
93
95
* The body can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB.
* The explicit content type of a message so it can be previewed correctly with the [List messages from the dashboard](/queues/examples/list-messages-from-dash/) feature. Optional argument.
108
110
* As of now, this option is for internal use. In the future, `contentType` will be used by alternative consumer types to explicitly mark messages as serialized so they can be consumed in the desired type.
109
111
* See [QueuesContentType](#queuescontenttype) for possible values.
110
112
111
-
* <code>delaySecondsnumber</code>
113
+
* <code>delaySeconds</code> <Typetext="number" />
112
114
113
115
* The number of seconds to [delay a message](/queues/configuration/batching-retries/) for within the queue, before it can be delivered to a consumer.
114
116
* Must be an integer between 0 and 43200 (12 hours). Setting this value to zero will explicitly prevent the message from being delayed, even if there is a global (default) delay at the queue level.
@@ -117,7 +119,7 @@ Optional configuration that applies when sending a message to a queue.
117
119
118
120
Optional configuration that applies when sending a batch of messages to a queue.
119
121
120
-
* <code>delaySecondsnumber</code>
122
+
* <code>delaySeconds</code> <Typetext="number" />
121
123
122
124
* The number of seconds to [delay messages](/queues/configuration/batching-retries/) for within the queue, before it can be delivered to a consumer.
* The name of the Queue that belongs to this batch.
223
225
224
-
* <code>messages</code> Message\[]
226
+
* <code>messages</code> <Typetext="Message[]" />
225
227
226
228
* An array of messages in the batch. Ordering of messages is best effort -- not guaranteed to be exactly the same as the order in which they were published. If you are interested in guaranteed FIFO ordering, please [email the Queues team](mailto:[email protected]).
227
229
228
-
* <code>ackAll()</code> void
230
+
* <code>ackAll()</code> <Typetext="void" />
231
+
229
232
230
233
* Marks every message as successfully delivered, regardless of whether your `queue()` consumer handler returns successfully or not.
* The body can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB.
268
271
269
-
* <code>attempts</code> number
272
+
* <code>attempts</code> <Typetext="number" />
270
273
271
274
* The number of times the consumer has attempted to process this message. Starts at 1.
272
275
273
-
* <code>ack()</code> void
276
+
* <code>ack()</code> <Typetext="void" />
274
277
275
278
* Marks a message as successfully delivered, regardless of whether your `queue()` consumer handler returns successfully or not.
0 commit comments