Why do CELERY_ROUTES have both a “queue” and a “routing_key”?

前端 未结 2 1341
情歌与酒
情歌与酒 2021-01-30 17:16

My understanding of AMQP is that messages only have the following components:

  1. The message body
  2. The routing key
  3. The exchange

Queues

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 17:29

    The point of having the queue declared in there, is for celery to create those queues and set up the configuration with RabbitMQ.

    For a lower level AMQP client, you need to first declare the queue, then the exchange, and then finally bind the exchange to the queue. Later when posting messages, you just post to the exchange.

    It seems like celery use this structure to do it automatically.

提交回复
热议问题