Skip to content

default_exchange config have no effect #3926

@zema1

Description

@zema1

I'm new for celery.I use the celeryconfig like the celery docs.

broker_url = 'amqp://guest:guest@localhost:5672//'

task_default_queue = 'default'
task_default_exchange = 'tasks'
task_default_exchange_type = 'topic'
task_default_routing_key = 'tasks.default'

task_queues = (
    Queue('default',   routing_key='tasks.#'),
    Queue('test', routing_key='test.#'),
)

As the doc says

task_queues is a list of Queue instances. If you don’t set the exchange or exchange type values for a key, these will be taken from the task_default_exchange and task_default_exchange_type settings.

But it seems have no effect when I use with the following command:

$ celery worker -A main -l info -Q default -n defaultserver
$ celery worker -A main -l info -Q test -n testWorker

The celery -A report result was

software -> celery:4.0.2 (latentcall) kombu:4.0.2 py:3.6.0
            billiard:3.5.0.2 py-amqp:2.1.4
platform -> system:Darwin arch:64bit imp:CPython
loader   -> celery.loaders.app.AppLoader
settings -> transport:amqp results:disabled

Queue: <class 'kombu.entity.Queue'>
broker_url: 'amqp://guest:********@localhost:5672//'
task_default_exchange: 'tasks'
task_default_exchange_type: 'topic'
task_default_queue: 'default'
task_default_routing_key: '********'
task_queues:
    (<unbound Queue default -> <unbound Exchange ''(direct)> -> tasks.#>,
 <unbound Queue test -> <unbound Exchange ''(direct)> -> test.#>)

the queues don't work well with the giving config.py there any silly operations?

And the main.py:


app = Celery('test')
app.config_from_object('celeryconfig')

@app.task
def add(x, y):
    time.sleep(x)
    return x + y

Thanks for any help.I was sad for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions