Skip to content

Commit f7b8aca

Browse files
committed
feature #14391 [Messenger] Added SQS Messenger docs (Simperfit, Nyholm)
This PR was submitted for the 5.x branch but it was merged into the 5.1 branch instead. Discussion ---------- [Messenger] Added SQS Messenger docs This will close #13328 and fix #13093 Commits ------- cf4331b Sort alphabetically 7d530ac Typos d198bb7 minor 5fa1465 Typo f56ddd3 Syntax fix d2fdd03 syntax 689df8c cs 47dbe33 Added SQS Messenger docs 9dd75a9 feat: add amazon sqs to docs
2 parents 4bdb8f8 + cf4331b commit f7b8aca

File tree

1 file changed

+69
-2
lines changed

1 file changed

+69
-2
lines changed

messenger.rst

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,72 @@ during a request::
11511151
:class:`Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase`
11521152
or :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase`.
11531153

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+
11541220
Serializing Messages
11551221
~~~~~~~~~~~~~~~~~~~~
11561222

@@ -1294,7 +1360,6 @@ by tagging the handler service with ``messenger.message_handler``
12941360
'handles' => SmsNotification::class,
12951361
]);
12961362
1297-
12981363
Possible options to configure with tags are:
12991364

13001365
* ``bus``
@@ -1595,7 +1660,6 @@ middleware and *only* include your own:
15951660
],
15961661
]);
15971662
1598-
15991663
.. note::
16001664

16011665
If a middleware service is abstract, a different instance of the service will
@@ -1724,3 +1788,6 @@ Learn more
17241788
.. _`streams`: https://redis.io/topics/streams-intro
17251789
.. _`Supervisor docs`: http://supervisord.org/
17261790
.. _`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

Comments
 (0)