Queue batching
Queues now send and receive in batches. sendBatch uses the cloud's own batch
API and returns one outcome per message, in input order:
const results = await tasks.sendBatch(images.map(id => ({ type: "resize", imageId: id })))
results.forEach((result, i) => {
if (result.status === "rejected") console.error(images[i], result.code)
})A message that's too large is rejected on its own, without failing the others.
An unknown outcome means the message may have been accepted, so retrying can
duplicate it.
On the consuming side, add batch: { maxMessages, maxWindowSeconds } to a
Worker's queue trigger and register onQueueBatch. It returns success or
retry per delivery, and retrying one doesn't affect the others.
- Remote queues: your backend can send into a customer's queue through a remote binding, with
send,sendText,sendBatch, andsendBatchText - Remote KV: KV is available as a remote binding too
- Python:
send_batchandon_queue_batch