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

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

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

问题描述

我只是触摸芹菜和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 ?

草稿想法是通过JSON序列化java函数然后由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

谢谢

推荐答案

您当然可以通过RabbitMQ从Java发送消息。用于与RabbitMQ连接的Java客户端库 -

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消息格式 - 一种风味使用JSON,并且有许多现有的Java库可以用JSON进行读写;请参阅

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

你是对的。

上面链接的页面包含代码片段,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发送任务芹菜吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 11:06