我正在使用芹菜4.0.2与rabbitmq 3.6.6和Django 1.10,这是我的配置:
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_app.settings')
app = Celery('my_app')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
app.conf.BROKER_URL = 'amqp://{}:{}@{}'.format(settings.AMQP_USER, settings.AMQP_PASSWORD, settings.AMQP_HOST)
app.conf.CELERY_DEFAULT_EXCHANGE = 'my_app.celery'
app.conf.CELERY_DEFAULT_QUEUE = 'my_app.celery_default'
app.conf.CELERY_TASK_SERIALIZER = 'json'
app.conf.CELERY_ACCEPT_CONTENT = ['json']
app.conf.CELERY_IGNORE_RESULT = True
app.conf.CELERY_DISABLE_RATE_LIMITS = True
app.conf.BROKER_POOL_LIMIT = 2
app.conf.CELERY_QUEUES = (
Queue(settings.QUEUE_1),
Queue(settings.QUEUE_2),
Queue(settings.QUEUE_3),
)
它工作正常,但是当我尝试添加新队列时,即
app.conf.CELERY_QUEUES = (
Queue(settings.QUEUE_1),
Queue(settings.QUEUE_2),
Queue(settings.QUEUE_3),
Queue(settings.QUEUE_4),
)
我收到此错误:
kombu.exceptions.NotBoundError: Can't call method on Exchange not bound to a channel
如果我删除其中一个队列,它会再次工作,因此它似乎仅限于3个队列。我不明白为什么。 Celery的推出方式如下:
celery worker -A my_app.celery_app
有什么想法吗?提前谢谢!