芹菜工作者/服务器可以接受非芹菜生产者的任务吗? [英] Can a celery worker/server accept tasks from a non celery producer?

查看:82
本文介绍了芹菜工作者/服务器可以接受非芹菜生产者的任务吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用用java nio编写的彗星服务器发送实时更新。接收信息时,我希望它扫描数据,然后通过rabbitmq将任务发送到工作线程。理想情况下,我希望将celery服务器放在Rabbit的另一端,以管理将处理这些任务的工作线程池。

I want to use a comet server written using java nio for sending out live updates. When receiving information I want it to scan the data, and send tasks to worker threads via rabbitmq. Ideally I would like a celery server to sit on the other end of rabbit, managing a pool of worker threads that will handle these tasks.

但是,据我了解,芹菜是通过坐在Rabbitmq的两端来工作的,它本质上通过嵌入消费者和消费者手中来接管生产者和消费者的角色。生产者代码。如上所述,有没有办法设置芹菜?谢谢

However, from my understanding, celery works by sitting on both ends of rabbitmq, and it essentially takes over the role of producer and consumer by being embedded in both the consumer and producer's code. Is there a way to set up celery as I described above? Thanks

推荐答案

不必使用Celery发布消息。您可以从自己的应用程序将消息发布到RabbitMQ或其他代理,然后使用Celery消耗任务。

It is not necessary to use Celery to publish messages. You can publish messages to RabbitMQ or to other broker from your own app and use Celery to consume tasks.

Celery使用简单消息协议。您可以在应用程序中实现客户端。

Celery uses simple message protocol. You can implement the client side in you application.

如果您不想实现协议的客户端,则可以实现一个简单的http服务器,该服务器接受请求并进行适当的呼叫。像

If you don't want to implement the client side of the protocol you can implement a simple http server which accepts requests and makes appropriate calls. Like this.

这篇关于芹菜工作者/服务器可以接受非芹菜生产者的任务吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆