Skip to content

[Messenger] Batch send for SQS #60748

Open
@ehsanfa

Description

@ehsanfa

Description

The current SenderInterface::send() method in Symfony Messenger only supports sending one Envelope at a time. When using Amazon SQS as the transport, this results in one HTTP request per message.

Since AWS charges per request, this behavior becomes inefficient and costly at scale. Amazon SQS supports sending up to 10 messages in a single batch via the SendMessageBatch API, which significantly reduces the number of requests and cost.

It would be beneficial if Messenger could support batching messages when sending to SQS

Example

interface BatchSenderInterface
{
    /**
     * @param Envelope[] $envelopes
     * @return Envelope[]
     */
    public function sendBatch(array $envelopes): array;
}
if ($transport instanceof BatchSenderInterface) {
    $transport->sendBatch($envelopes);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions