开发者

Can we create queue in rabbitmq with python

开发者 https://www.devze.com 2023-04-12 06:49 出处:网络
I\'m working on project that nee开发者_开发技巧d to control sending queue by code. So I just curious that anybody use to create queue in rabbitmq by python/django code? :)Usual python clients should d

I'm working on project that nee开发者_开发技巧d to control sending queue by code. So I just curious that anybody use to create queue in rabbitmq by python/django code? :)


Usual python clients should do from django (but beware, you may need to block the request when you're running AMQP commands). Take a look at rabbitmq tutorials

  • http://www.rabbitmq.com/getstarted.html
  • https://github.com/rabbitmq/rabbitmq-tutorials

There are at least three python clients: python-amqplib, pika and puka.

Also, you may find www.celeryproject.org useful.


In AMQP, you don't create a queue. Instead, you declare a queue, and if the queue doesn't already exist, then it is created.

In some cases all you need to do is to declare the queue in the processes that consume messages. But if you want persistent and durable queues then it is best to declare them beforehand with a shell script, or in the message publisher. Even if the message publisher does not do anything with the queue, it can still declare it to ensure that messages from the exchange are never dropped.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号