我可以通过rabbitmq使用java发送任务到芹菜吗?

Can I use java send task to celery through rabbitmq?(我可以通过rabbitmq使用java发送任务到芹菜吗?)
本文介绍了我可以通过rabbitmq使用java发送任务到芹菜吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我刚接触 celery 和 java 2 天.:(

I just touch celery and java for 2 days. :(

现在,我有一个java客户端通过rabbitmq发送任务的任务.Celery 将是处理任务的工人.

Right now, I have a task that java client send task through rabbitmq. Celery will be the worker to handle task.

我知道 Python->rabbitmq->celery 很容易.但是我可以通过 java->rabbitmq->celery 做到这一点吗?

I know it's easy for Python->rabbitmq->celery. But can I do this by java->rabbitmq->celery ?

草稿思路是把java函数用json序列化,然后用rabbitmq发送,再用celery处理.

The draft idea is that serialization the java function by JSON and then send by rabbitmq, and then handle by celery.

最好有示例代码,可以直接运行

It's better to have example code and could be run directly

谢谢

推荐答案

你当然可以从 Java 中通过 RabbitMQ 发送消息.有一个用于与 RabbitMQ 交互的 Java 客户端库 - http://www.rabbitmq.com/api-guide.html

You can certainly send messages through RabbitMQ from Java. There is a Java client-side library for interfacing with RabbitMQ - http://www.rabbitmq.com/api-guide.html

本页描述了 Celery 消息格式 - http://docs.celeryproject.org/en/latest/internals/protocol.html.一种风格使用 JSON,并且有很多现有的 Java 库用于 JSON 读写;请参阅 http://json.org

This page describes the Celery message format - http://docs.celeryproject.org/en/latest/internals/protocol.html. One flavour uses JSON, and there are lots of existing Java libraries for reading and writing in JSON; see http://json.org

最好有示例代码,可以直接运行

It's better to have example code and could be run directly

你是对的.

上面链接的页面包含代码片段,RabbitMQ Java 库有一些(小)示例.(至少,页面上是这么说的.)

The page linked above includes code snippets, and the RabbitMQ Java library has some (small) examples. (At least, that's what the page says.)

这篇关于我可以通过rabbitmq使用java发送任务到芹菜吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How to implement RecyclerView with section header depending on category?(如何根据类别实现带有节标题的 RecyclerView?)
How to generate JNI header file in Eclipse(如何在 Eclipse 中生成 JNI 头文件)
Setting a custom HTTP header dynamically with Spring-WS client(使用 Spring-WS 客户端动态设置自定义 HTTP 标头)
Could you technically call the string[] anything in the main method?(从技术上讲,您可以在 main 方法中调用 string[] 吗?)
What is the proper way of setting headers in a URLConnection?(在 URLConnection 中设置标头的正确方法是什么?)
How to overwrite http-header quot;Hostquot; in a HttpURLConnection?(如何覆盖 http-header “主机在 HttpURLConnection 中?)