Open
Description
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);
}