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

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

问题描述

我想使用一个用 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.

但是,据我了解,celery 的工作原理是坐在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 使用简单的消息protocol.您可以在您的应用程序中实现客户端.

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天全站免登陆