Skip to content

[Messenger] Add new messenger:stats command that return a list of transports with their "to be processed" message count. #17322

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
Oct 3, 2022
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
31 changes: 29 additions & 2 deletions messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,35 @@ You can limit the worker to only process messages from specific queue(s):
# you can pass the --queues option more than once to process multiple queues
$ php bin/console messenger:consume my_transport --queues=fasttrack1 --queues=fasttrack2

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

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

.. _messenger-message-count:

Knowing the number of messages in the "queue" for transport(s)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you want to know how many messages are in the "queues",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Begin with a version added directive for version 6.2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I had forgotten

you can do so with the ``messenger:stats`` command:

.. code-block:: terminal

# displays the number of messages in the "queue" for all transports
$ php bin/console messenger:stats

# or specific transport(s) only
$ php bin/console messenger:stats my_transport_name other_transport_name

.. note::

This command won't work if the configured transport's receiver does not implement
:class:`Symfony\\Component\\Messenger\\Transport\\Receiver\\MessageCountAwareInterface`.

.. versionadded:: 6.2

The ``messenger:stats`` command was introduced in Symfony 6.2.

.. _messenger-supervisor:

Expand Down