Skip to content

[Messenger] Batch send for SQS #60748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ehsanfa opened this issue Jun 9, 2025 · 0 comments
Open

[Messenger] Batch send for SQS #60748

ehsanfa opened this issue Jun 9, 2025 · 0 comments

Comments

@ehsanfa
Copy link

ehsanfa commented Jun 9, 2025

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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants