@@ -587,6 +587,29 @@ to handle messages in a priority order:
587
587
The worker will always first look for messages waiting on ``async_priority_high ``. If
588
588
there are none, *then * it will consume messages from ``async_priority_low ``.
589
589
590
+ .. _messenger-limit-queues :
591
+
592
+ Limit Consuming to Specific Queues
593
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
594
+
595
+ Some transports (notably AMQP) have the concept of exchanges and queues. A Symfony
596
+ transport is always bound to an exchange. By default, the worker consumes from all
597
+ queues attached to the exchange of the specified transport. However, there are use
598
+ cases to want a worker to only consume from specific queues.
599
+
600
+ You can limit the worker to only process messages from specific queues:
601
+
602
+ .. code-block :: terminal
603
+
604
+ $ php bin/console messenger:consume my_transport --queues=fasttrack
605
+
606
+ To allow using the ``queues `` option, the receiver must implement the
607
+ :class: `Symfony\\ Component\\ Messenger\\ Transport\\ Receiver\\ QueueReceiverInterface `.
608
+
609
+ .. versionadded :: 5.3
610
+
611
+ Limiting the worker to specific queues was introduced in Symfony 5.3.
612
+
590
613
.. _messenger-supervisor :
591
614
592
615
Supervisor Configuration
@@ -950,6 +973,11 @@ it in the ``port`` parameter of the DSN (e.g. ``amqps://localhost?cacert=/etc/ss
950
973
binding keys that are needed. That can be disabled, but some functionality
951
974
may not work correctly (like delayed queues).
952
975
976
+ .. note ::
977
+
978
+ With Symfony 5.3 or newer, you can limit the consumer of an AMQP transport to only
979
+ process messages from some queues of an exchange. See :ref: `messenger-limit-queues `.
980
+
953
981
The transport has a number of other options, including ways to configure
954
982
the exchange, queues binding keys and more. See the documentation on
955
983
:class: `Symfony\\ Component\\ Messenger\\ Bridge\\ Amqp\\ Transport\\ Connection `.
0 commit comments