method Queue.prototype.sendBatch
Queue.prototype.sendBatch<T>(
queue: string,
data: T[],
options?: SendOptions & { parallel?: boolean; },
): Task<string[], QueueSendFailed>

Send multiple messages to a queue in batch.

Examples

Batch send

const ids = await queue.sendBatch("notifications", [
  { to: "user1@example.com", subject: "Welcome!" },
  { to: "user2@example.com", subject: "Welcome!" },
]).run();

Parallel batch send (for adapters that support it)

const ids = await queue.sendBatch("notifications", items, { parallel: true }).run();

Type Parameters

Parameters

queue: string
data: T[]
optional
options: SendOptions & { parallel?: boolean; }

Return Type