@@ -587,6 +587,29 @@ to handle messages in a priority order:
587587 The worker will always first look for messages waiting on ``async_priority_high ``. If
588588there are none, *then * it will consume messages from ``async_priority_low ``.
589589
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+
590613.. _messenger-supervisor :
591614
592615Supervisor Configuration
@@ -950,6 +973,11 @@ it in the ``port`` parameter of the DSN (e.g. ``amqps://localhost?cacert=/etc/ss
950973 binding keys that are needed. That can be disabled, but some functionality
951974 may not work correctly (like delayed queues).
952975
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+
953981The transport has a number of other options, including ways to configure
954982the exchange, queues binding keys and more. See the documentation on
955983:class: `Symfony\\ Component\\ Messenger\\ Bridge\\ Amqp\\ Transport\\ Connection `.
0 commit comments