Skip to content

Commit 6d84eef

Browse files
mdoutreluingnejaviereguiluz
authored andcommitted
[Messenger] Add new messenger:stats command that return a list of transports with their "to be processed" message count.
1 parent 01714e1 commit 6d84eef

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

messenger.rst

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,35 @@ You can limit the worker to only process messages from specific queue(s):
640640
# you can pass the --queues option more than once to process multiple queues
641641
$ php bin/console messenger:consume my_transport --queues=fasttrack1 --queues=fasttrack2
642642
643-
To allow using the ``queues`` option, the receiver must implement the
644-
:class:`Symfony\\Component\\Messenger\\Transport\\Receiver\\QueueReceiverInterface`.
643+
.. note::
644+
645+
To allow using the ``queues`` option, the receiver must implement the
646+
:class:`Symfony\\Component\\Messenger\\Transport\\Receiver\\QueueReceiverInterface`.
647+
648+
.. _messenger-message-count:
649+
650+
Knowing the number of messages in the "queue" for transport(s)
651+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
652+
653+
If you want to know how many messages are in the "queues",
654+
you can do so with the ``messenger:stats`` command:
655+
656+
.. code-block:: terminal
657+
658+
# displays the number of messages in the "queue" for all transports
659+
$ php bin/console messenger:stats
660+
661+
# or specific transport(s) only
662+
$ php bin/console messenger:stats my_transport_name other_transport_name
663+
664+
.. note::
665+
666+
This command won't work if the configured transport's receiver does not implement
667+
:class:`Symfony\\Component\\Messenger\\Transport\\Receiver\\MessageCountAwareInterface`.
668+
669+
.. versionadded:: 6.2
670+
671+
The ``messenger:stats`` command was introduced in Symfony 6.2.
645672

646673
.. _messenger-supervisor:
647674

0 commit comments

Comments
 (0)