@@ -1151,6 +1151,72 @@ during a request::
1151
1151
:class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ KernelTestCase `
1152
1152
or :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ WebTestCase `.
1153
1153
1154
+ Amazon SQS
1155
+ ~~~~~~~~~~
1156
+
1157
+ .. versionadded :: 5.1
1158
+
1159
+ The Amazon SQS transport has been added in Symfony 5.1
1160
+ Install it by running:
1161
+
1162
+ .. code-block :: terminal
1163
+
1164
+ $ composer require symfony/amazon-sqs-messenger
1165
+
1166
+ The ``SQS `` transport configuration looks like this:
1167
+
1168
+ .. code-block :: bash
1169
+
1170
+ # .env
1171
+ MESSENGER_TRANSPORT_DSN=sqs://AKIAIOSFODNN7EXAMPLE:j17M97ffSVoKI0briFoo9a@sqs.eu-west-3.amazonaws.com/messages
1172
+ # MESSENGER_TRANSPORT_DSN=sqs://localhost:9494/messages?sslmode=disable
1173
+
1174
+ .. note ::
1175
+
1176
+ The transport will automatically create queues that are needed. This
1177
+ can be disabled setting the "auto_setup" option to ``false ``.
1178
+
1179
+ A number of options can be configured via the DSN or via the ``options `` key
1180
+ under the transport in ``messenger.yaml ``:
1181
+
1182
+ ================== ====================================== ======================
1183
+ Option Description Default
1184
+ ================== ====================================== ======================
1185
+ access_key AWS access key
1186
+ account Identifier of the AWS account The owner of the credentials
1187
+ auto_setup Whether the table should be created true
1188
+ automatically during send / get.
1189
+ buffer_size Number of messages to prefetch 9
1190
+ endpoint Absolute URL to the SQS service https://sqs.eu-west-1.amazonaws.com
1191
+ poll_timeout Wait for new message duration in 0.1
1192
+ seconds
1193
+ queue_name Name of the queue messages
1194
+ region Name of the AWS region eu-west-1
1195
+ secret_key AWS secret key
1196
+ visibility_timeout Amount of seconds the message will Queue's configuration
1197
+ not be visible (`Visibility Timeout `_)
1198
+ wait_time `Long polling `_ duration in seconds 20
1199
+ ================== ====================================== ======================
1200
+
1201
+ .. note ::
1202
+
1203
+ The ``wait_time `` parameter defines the maximum duration Amazon SQS should
1204
+ wait until a message is available in a queue before sending a response.
1205
+ It helps reducing the cost of using Amazon SQS by eliminating the number
1206
+ of empty responses.
1207
+
1208
+ The ``poll_timeout `` parameter defines the duration the receiver should wait
1209
+ before returning null. It avoids blocking other receivers from being called.
1210
+
1211
+ .. note ::
1212
+
1213
+ If the queue name is suffixed by ``.fifo ``, AWS will create a `FIFO queue `_.
1214
+ Use the stamp :class: `Symfony\\ Component\\ Messenger\\ Bridge\\ AmazonSqs\\ Transport\\ AmazonSqsFifoStamp `
1215
+ to define the ``Message group ID `` and the ``Message deduplication ID ``.
1216
+
1217
+ FIFO queues don't support setting a delay per message, a value of ``delay: 0 ``
1218
+ is required in the retry strategy settings.
1219
+
1154
1220
Serializing Messages
1155
1221
~~~~~~~~~~~~~~~~~~~~
1156
1222
@@ -1294,7 +1360,6 @@ by tagging the handler service with ``messenger.message_handler``
1294
1360
'handles' => SmsNotification::class,
1295
1361
]);
1296
1362
1297
-
1298
1363
Possible options to configure with tags are:
1299
1364
1300
1365
* ``bus ``
@@ -1595,7 +1660,6 @@ middleware and *only* include your own:
1595
1660
],
1596
1661
]);
1597
1662
1598
-
1599
1663
.. note ::
1600
1664
1601
1665
If a middleware service is abstract, a different instance of the service will
@@ -1724,3 +1788,6 @@ Learn more
1724
1788
.. _`streams` : https://redis.io/topics/streams-intro
1725
1789
.. _`Supervisor docs` : http://supervisord.org/
1726
1790
.. _`SymfonyCasts' message serializer tutorial` : https://symfonycasts.com/screencast/messenger/transport-serializer
1791
+ .. _`Long polling` : https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html
1792
+ .. _`Visibility Timeout` : https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
1793
+ .. _`FIFO queue` : https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
0 commit comments