Skip to content

Commit e17aad8

Browse files
committed
feature #14921 [Messenger] message consume command --queue parameter (dbu)
This PR was merged into the 5.3-dev branch. Discussion ---------- [Messenger] message consume command --queue parameter Feature introduced in symfony/symfony#38973 fix #14919 I was considering whether to provide a full, meaningful example, but don't see where this would fit. Do you see a place where that should go? Otherwise i will write up the example as a blog post. Commits ------- 77007c1 message consume command --queue parameter
2 parents 476c62f + 77007c1 commit e17aad8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

messenger.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
588588
there 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

592615
Supervisor 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+
953981
The transport has a number of other options, including ways to configure
954982
the exchange, queues binding keys and more. See the documentation on
955983
:class:`Symfony\\Component\\Messenger\\Bridge\\Amqp\\Transport\\Connection`.

0 commit comments

Comments
 (0)