Symfony Messenger(消息队列),如何获得队列状态?

发布于 2025-01-26 14:25:07 字数 445 浏览 4 评论 0原文

我正在接近 symfony 4.4消息队列带有学说运输

如何总体看出队列状态?

我注意到,学说将队列存储在表messenger_messages中,显然我可以查询此表以获取此信息,但是我敢肯定,Symfony有一种本机方法来获得排队状态。

我想得到:

  • 队列中的消息数量
  • 在此刻处理的消息数量

I am approaching Symfony 4.4 Message Queue with the Doctrine Transport.

How can I get an overall view of the queue status?

I noticed that Doctrine stores the queue in the table messenger_messages, obviously I could query this table to get this info, but I'm sure that Symfony has a native way to get the queue status.

I would like to get:

  • the number of messages in the queue
  • the number of messages that are in handling in this moment

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你げ笑在眉眼 2025-02-02 14:25:07

更新:
从Symfony 6.2(当前版本)开始,现在有一个控制台命令检查消息统计数据。
来源:检查每次运输的排队消息


不幸的是,Symfony中没有本机的方式(从v5.4/V6)与默认消息队列没有。
但是可能的解决方案是:

  1. 正如您所说,请使用
  2. 您需要的命令(例如,阅读消息表并打印所需的信息),
  3. 使用替代消息系统扩展了 控制台(例如兔子)

UPDATE:
As of Symfony 6.2 (current release), there is now a console command to check message stats.
Source: Checking the Number of Queued Messages Per Transport


Unfortunatley there is no native way in Symfony (as of v5.4/v6) with the default message queue.
But possible solutions are:

  1. As you said, take a look in to the message table
  2. Extend the console with your own commands you need (for example reading the message table and print the needed informations)
  3. Using alternative message system which has this functionality already build in (such as RabbitMQ)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文