Skip to content

PublishBatch

Source: src/AWS/SNS/PublishBatch.ts

Runtime binding for sns:PublishBatch.

Bind this operation to a Topic inside a function runtime to publish up to 10 messages per call with per-entry success/failure results. The binding grants the host function sns:Publish on the topic. Provide the PublishBatchHttp 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 TopicSink.

// init (provide SNS.PublishBatchHttp on the Function)
const publishBatch = yield* SNS.PublishBatch(topic);
// runtime
const response = yield* publishBatch({
PublishBatchRequestEntries: messages.map((message, index) => ({
Id: `${index}`,
Message: message,
})),
});
// response.Successful / response.Failed