使用 Celery 和 RabbitMQ 的简单队列
我正在尝试实现一个一次执行一项任务的简单队列。使用 Celery 从主线程卸载任务并在 Celery 配置中设置 concurrency=1 效果很好,但我可能想使用更多并发工作线程来执行其他任务。
有没有办法告诉 Celery 或 RabbitMQ 不要使用多个并发工作线程来执行任务(除非强制 concurrency=1)?我在文档中找不到任何内容,但也许这些工具不是为线性队列设计的?
谢谢!
I'm trying to implement a simple queue that performs one task at a time. Offloading tasks off the main thread using Celery and setting concurrency=1 in the Celery config works fine, but I might want to use more concurrent workers for other tasks.
Is there a way to tell Celery or RabbitMQ to not use multiple concurrent workers for a task (except by forcing concurrency=1)? I can't find anything in the documentation but maybe these tools are not designed for a linear queue?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您需要的是每种类型的任务都有一个单独的队列。创建从每个队列进行消费的单独工作线程,并发度设置为 1。
I think what you need is a separate queue for each type of task. Create separate workers that consume from each queue, with concurrency set to 1.