如何使用 celery 和 django 来运行rabbitmq队列中已有的任务?

发布于 2024-12-17 09:57:45 字数 311 浏览 3 评论 0原文

至此我已经阅读了大部分rabbitmq文档和celery文档,并且google了很多遍。基本上我无法在任何地方找到我需要的信息。

我有一个扭曲的网络服务器读取传递给它的消息,并使用鼠兔将消息放入队列中。效果很好。我遇到的问题是我从这里所做的事情。将会发生的情况是,我想定期(使用 celerybeat)消耗队列中当前的内容。我遇到的大问题是我不知道如何将任务传递到rabbitmq以便celery(或celerybeat)可以分配要完成的任务。

提出这个问题的最简单方法是:我可以读取以数据为主体的队列并在 django 中使用该数据吗?

任何帮助将不胜感激。

At this point I have read most of the rabbitmq documentation and the celery documentation, and google soo many times. Essentially I can't find anywhere the information that I'm needing.

I have a twisted webserver reading messages passed to it, and putting the message into a queue using pika. That works fine. The problem I am having is what I do from here. What will happen is that periodically (using celerybeat) I want to consume what is currently in the queue. The big problem I am having is that I have no idea how to pass tasks into rabbitmq so that celery (or celerybeat) can assign the tasks to be completed.

The easiest way to ask this question is: Can I read queues which have data as the body and use that data in django?

Any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

滿滿的愛 2024-12-24 09:57:45

我不确定这是否有任何帮助,但我使用 djcelery 从 django 进行任务排队,这个队列到rabbit mq,

一个单独的 python manage.py (celeryd|celerybeat) 进程根据 django

https://github.com/ask/django-celery

I'm not sure if this is of any help, but i use djcelery for task queueing from django, this queues to rabbit mq

a seperate python manage.py (celeryd|celerybeat) process picks up queued tasks based on settings in django

https://github.com/ask/django-celery

冧九 2024-12-24 09:57:45

我认为我有同样的问题,但让我重申一下以确定:

您可以使用 Celery 来消费由另一个非 Django、非 Celery 进程放入 RabbitMQ 的消息吗?例如,如果 Java 系统在购买时向 RabbitMQ 发送消息,Celery 任务是否可以响应该消息并采取某些操作?

I think I have the same question, but let me restate it to be sure:

Can you use Celery to consume messages that were put into RabbitMQ by another non-Django, non-Celery process? For example, if a Java system sends a message to RabbitMQ when a purchase is made can a Celery task respond to that message and take some action?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文