Skip to content

Commit ffe9dff

Browse files
committed
Documented redis consumer group relation
1 parent cbd36aa commit ffe9dff

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

messenger.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,29 @@ serializer How to serialize the final payload ``Redis::SERIALIZER_PHP`
900900
``Redis::OPT_SERIALIZER`` option)
901901
================== =================================== =======
902902

903+
.. tip::
904+
905+
At some point you'll likely want to scale the number of workers working on your queue.
906+
Make sure you assign the correct ``consumer`` and ``group`` values in that case.
907+
The more likely case is that each worker shall work on the queue independently, reducing
908+
the time needed to process the pending messages. In that case, every single worker
909+
must have a different ``consumer`` configuration value. When working with Docker
910+
containers one idea might be to use the ``HOSTNAME`` environment variable:
911+
912+
.. configuration-block::
913+
914+
.. code-block:: yaml
915+
916+
# config/packages/messenger.yaml
917+
framework:
918+
messenger:
919+
transports:
920+
redis: 'redis://localhost:6379/messages/symfony/%env(HOSTNAME)%'
921+
922+
The less likely case would be if you wanted to have every single worker to process every single message.
923+
That means messages would be processed multiple times. In that case, you must have different ``group``
924+
configurations.
925+
903926
In Memory Transport
904927
~~~~~~~~~~~~~~~~~~~
905928

0 commit comments

Comments
 (0)