Skip to content

SendMessageBatch

Source: src/AWS/SQS/SendMessageBatch.ts

Runtime binding for sqs:SendMessageBatch.

Bind this operation to a Queue inside a function runtime to send up to 10 messages per call with per-entry success/failure results. The binding grants the host function sqs:SendMessage on the queue. Provide the SendMessageBatchHttp layer on the Function to implement the binding.

For an unbounded stream of messages with automatic batching and bounded retry of transient per-entry failures, prefer QueueSink.

// init (provide SQS.SendMessageBatchHttp on the Function)
const sendMessageBatch = yield* SQS.SendMessageBatch(queue);
// runtime
const result = yield* sendMessageBatch({
Entries: messages.map((body, index) => ({
Id: `${index}`,
MessageBody: body,
})),
});
// result.Successful / result.Failed