Skip to content

SQS  >  Operations  >  send_message_batch

send_message_batch

Operation

send_message_batch async

send_message_batch(input: SendMessageBatchInput, plugins: list[Plugin] | None = None) -> SendMessageBatchOutput

You can use SendMessageBatch to send up to 10 messages to the specified queue by assigning either identical or different values to each message (or by not assigning values at all). This is a batch version of ``SendMessage``. For a FIFO queue, multiple messages within a single batch are enqueued in the order they are sent.

The result of sending each message is reported individually in the response. Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of 200.

The maximum allowed individual message size and the maximum total payload size (the sum of the individual lengths of all of the batched messages) are both 1 MiB 1,048,576 bytes.

Warning

A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed. For more information, see the W3C specification for characters.

#x9 | #xA | #xD | #x20 to #xD7FF | #xE000 to #xFFFD | #x10000 to #x10FFFF

If a message contains characters outside the allowed set, Amazon SQS rejects the message and returns an InvalidMessageContents error. Ensure that your message body includes only valid characters to avoid this exception.

If you don't specify the DelaySeconds parameter for an entry, Amazon SQS uses the default value for the queue.

Parameters:

Name Type Description Default
input SendMessageBatchInput

An instance of SendMessageBatchInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
SendMessageBatchOutput

An instance of SendMessageBatchOutput.

Input

SendMessageBatchInput dataclass

Attributes

entries class-attribute instance-attribute
entries: list[SendMessageBatchRequestEntry] | None = None

A list of ``SendMessageBatchRequestEntry`` items.

queue_url class-attribute instance-attribute
queue_url: str | None = None

The URL of the Amazon SQS queue to which batched messages are sent.

Queue URLs and names are case-sensitive.

Output

SendMessageBatchOutput dataclass

For each message in the batch, the response contains a ``SendMessageBatchResultEntry`` tag if the message succeeds or a ``BatchResultErrorEntry`` tag if the message fails.

Attributes

failed instance-attribute

A list of ``BatchResultErrorEntry`` items with error details about each message that can't be enqueued.

successful instance-attribute

A list of ``SendMessageBatchResultEntry`` items.