@@ -1268,6 +1268,73 @@ during a request::
12681268 :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ KernelTestCase `
12691269 or :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ WebTestCase `.
12701270
1271+ Amazon SQS
1272+ ~~~~~~~~~~
1273+
1274+ .. versionadded :: 5.1
1275+
1276+ The Amazon SQS transport as introduced in Symfony 5.1.
1277+
1278+ Install Amazon SQS transport by running:
1279+
1280+ .. code-block :: terminal
1281+
1282+ $ composer require symfony/amazon-sqs-messenger
1283+
1284+ The ``SQS `` transport configuration looks like this:
1285+
1286+ .. code-block :: env
1287+
1288+ # .env
1289+ MESSENGER_TRANSPORT_DSN=sqs://AKIAIOSFODNN7EXAMPLE:j17M97ffSVoKI0briFoo9a@sqs.eu-west-3.amazonaws.com/messages
1290+ #MESSENGER_TRANSPORT_DSN=sqs://localhost:9494/messages?sslmode=disable
1291+
1292+ .. note ::
1293+
1294+ The transport will automatically create queues that are needed. This
1295+ can be disabled setting the ``auto_setup `` option to ``false ``.
1296+
1297+ A number of options can be configured via the DSN or via the ``options `` key
1298+ under the transport in ``messenger.yaml ``:
1299+
1300+ ====================== ====================================== ===================================
1301+ Option Description Default
1302+ ====================== ====================================== ===================================
1303+ ``access_key `` AWS access key
1304+ ``account `` Identifier of the AWS account The owner of the credentials
1305+ ``auto_setup `` Whether the table should be created ``true ``
1306+ automatically during send / get.
1307+ ``buffer_size `` Number of messages to prefetch 9
1308+ ``endpoint `` Absolute URL to the SQS service https://sqs.eu-west-1.amazonaws.com
1309+ ``poll_timeout `` Wait for new message duration in 0.1
1310+ seconds
1311+ ``queue_name `` Name of the queue messages
1312+ ``region `` Name of the AWS region eu-west-1
1313+ ``secret_key `` AWS secret key
1314+ ``visibility_timeout `` Amount of seconds the message will Queue's configuration
1315+ not be visible (`Visibility Timeout `_)
1316+ ``wait_time `` `Long polling `_ duration in seconds 20
1317+ ====================== ====================================== ===================================
1318+
1319+ .. note ::
1320+
1321+ The ``wait_time `` parameter defines the maximum duration Amazon SQS should
1322+ wait until a message is available in a queue before sending a response.
1323+ It helps reducing the cost of using Amazon SQS by eliminating the number
1324+ of empty responses.
1325+
1326+ The ``poll_timeout `` parameter defines the duration the receiver should wait
1327+ before returning null. It avoids blocking other receivers from being called.
1328+
1329+ .. note ::
1330+
1331+ If the queue name is suffixed by ``.fifo ``, AWS will create a `FIFO queue `_.
1332+ Use the stamp :class: `Symfony\\ Component\\ Messenger\\ Bridge\\ AmazonSqs\\ Transport\\ AmazonSqsFifoStamp `
1333+ to define the ``Message group ID `` and the ``Message deduplication ID ``.
1334+
1335+ FIFO queues don't support setting a delay per message, a value of ``delay: 0 ``
1336+ is required in the retry strategy settings.
1337+
12711338Serializing Messages
12721339~~~~~~~~~~~~~~~~~~~~
12731340
@@ -1411,7 +1478,6 @@ by tagging the handler service with ``messenger.message_handler``
14111478 'handles' => SmsNotification::class,
14121479 ]);
14131480
1414-
14151481 Possible options to configure with tags are:
14161482
14171483* ``bus ``
@@ -1712,7 +1778,6 @@ middleware and *only* include your own:
17121778 ],
17131779 ]);
17141780
1715-
17161781 .. note ::
17171782
17181783 If a middleware service is abstract, a different instance of the service will
@@ -1841,3 +1906,6 @@ Learn more
18411906.. _`streams` : https://redis.io/topics/streams-intro
18421907.. _`Supervisor docs` : http://supervisord.org/
18431908.. _`SymfonyCasts' message serializer tutorial` : https://symfonycasts.com/screencast/messenger/transport-serializer
1909+ .. _`Long polling` : https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html
1910+ .. _`Visibility Timeout` : https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
1911+ .. _`FIFO queue` : https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
0 commit comments