如何查看 RabbitMQ 中的排队任务?

2022-01-11 00:00:00 python celery rabbitmq

问题描述

我使用 RabbitMQ 作为我的消息代理,我的工作人员是 Celery 任务.我正在尝试诊断一个问题,即我将任务排入 RabbitMQ 但 Celery 没有接听.

I'm using RabbitMQ as my message broker and my workers are Celery tasks. I'm trying to diagnose an issue where I'm enqueue tasks to RabbitMQ but Celery doesn't pick then up.

有什么方法可以检查 RabbitMQ 中排队的任务是什么?我想查看它们入队的日期和时间、指定的任何 ETA、参数和任务名称.

Is there a way I can check what tasks are enqueued in RabbitMQ? I'd like to see the date and time when they are enqueued, any ETA is specified, the arguments and the task name.

我无法在文档中找到这些信息——也许我忽略了它——并且希望你们中的一些人可能知道检查任务队列的简单方法.谢谢.

I haven't been able to find this information in the docs — maybe I've overlooked it — and was hoping that some of you might know an easy way to inspect the task queue. Thanks.


解决方案

你可以使用Flower实时监控任务.

You can use Flower to monitor tasks in real time.

https://github.com/mher/flower

还检查 rabbitmqclt 命令检查 RabbitMQ 服务器状态:

Check out also rabbitmqclt command which inspects RabbitMQ server status:

http://www.rabbitmq.com/man/rabbitmqctl.1.man.html

rabbitmqctl list_queues

相关文章