我按官网文档上面的来添加了这段代码在 celery_config 里面
CELERY_QUEUES = (Broadcast(name='broadcast_tasks',),)
#
CELERY_ROUTES = {
'celery_task.method.get_new_method': {
'queue': 'broadcast_tasks',
# 'exchange': Exchange(type='fanout')
}
}
启动的时候会直接报错
PreconditionFailed: Exchange.declare: (406) PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'broadcast_tasks' in vhost '/': received 'fanout' but current is 'direct'
环境是 py2.7+ celery4.2 + rabbitmq 3.6 是什么原因导致这个问题,搜了 stackoverflow 也没看到有好的解决方法