在RabbitMQ服务器中生成具有随机GUID的队列

在RabbitMQ服务器中生成具有随机GUID的队列

本文介绍了在RabbitMQ服务器中生成具有随机GUID的队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从交换'celeryresults'生成带有随机GUID的队列。

Queues with a random GUID are being generated comming from exchange 'celeryresults'.

这种情况是在我使用延迟方法从shell触发任务时发生的,但我忘记在延迟的参数列表中输入原始功能的参数。

This happened when I fired a task from the shell, using delay method, but I forgot to enter parameters of my original function in the arguments list of delay.

在运行芹菜工人的终端上显示错误:

Error displayed in terminal where I run the celery worker:

[2015-02-20 18:42:48,547: ERROR/MainProcess] Task customers.tasks.sendmail_task[1a4daf49-81bf-4122-8dea-2ee76c2a2ff8] raised unexpected: TypeError('sendmail_task() takes exactly 4 arguments (0 given)',)
Traceback (most recent call last):
  File "/home/cod/workspace/envs/cod/lib/python2.6/site-packages/celery/app/trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/cod/workspace/envs/cod/lib/python2.6/site-packages/celery/app/trace.py", line 438, in __protected_call__
return self.run(*args, **kwargs)
TypeError: sendmail_task() takes exactly 4 arguments (0 given)

如何阻止随机队列的生成?为什么这些消息不使用默认队列?

How do I stop random queues from being generated? Why won't these messages use the default queue?

推荐答案

经纪人有区别(发送/接收消息)和后端(存储/获取任务结果)在芹菜中。听起来您好像同时使用RabbitMQ作为消息代理和结果后端。

There is a difference between the broker (sends/receives messages) and backend (stores/fetches task results) in celery. It sounds like you are using RabbitMQ both as the message broker and the result backend.

当将RabbitMQ用作结果后端时,celery为每个任务创建一个队列以暂时保留跟踪结果。 对此进行了说明

When RabbitMQ is used as a result backend, celery creates one queue per task to temporarily keep track of the result. This is described in the RabbitMQ Result Backend section of the docs.

如果您不希望出现这种情况,则可以使用或切换到。

If you don't want this behavior then you should either turn it off using CELERY_IGNORE_RESULT or switch to one of the other backend implementations listed in the Result Backend Settings.

这篇关于在RabbitMQ服务器中生成具有随机GUID的队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 03:56