Skip to content

[Messenger] message consume command --queue parameter #14921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,29 @@ to handle messages in a priority order:
The worker will always first look for messages waiting on ``async_priority_high``. If
there are none, *then* it will consume messages from ``async_priority_low``.

.. _messenger-limit-queues:

Limit Consuming to Specific Queues
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Some transports (notably AMQP) have the concept of exchanges and queues. A Symfony
transport is always bound to an exchange. By default, the worker consumes from all
queues attached to the exchange of the specified transport. However, there are use
cases to want a worker to only consume from specific queues.

You can limit the worker to only process messages from specific queues:

.. code-block:: terminal

$ php bin/console messenger:consume my_transport --queues=fasttrack

To allow using the ``queues`` option, the receiver must implement the
:class:`Symfony\\Component\\Messenger\\Transport\\Receiver\\QueueReceiverInterface`.

.. versionadded:: 5.3

Limiting the worker to specific queues was introduced in Symfony 5.3.

.. _messenger-supervisor:

Supervisor Configuration
Expand Down Expand Up @@ -950,6 +973,11 @@ it in the ``port`` parameter of the DSN (e.g. ``amqps://localhost?cacert=/etc/ss
binding keys that are needed. That can be disabled, but some functionality
may not work correctly (like delayed queues).

.. note::

With Symfony 5.3 or newer, you can limit the consumer of an AMQP transport to only
process messages from some queues of an exchange. See :ref:`messenger-limit-queues`.

The transport has a number of other options, including ways to configure
the exchange, queues binding keys and more. See the documentation on
:class:`Symfony\\Component\\Messenger\\Bridge\\Amqp\\Transport\\Connection`.
Expand Down