Is it possible to use java send task for celery through rabbitmq?

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

Now I have a task so that the java client sends the task via rabbitmq. Celery will be working to do the job.

I know this is easy for Python-> rabbitmq-> celery. But can I do this via java-> rabbitmq-> celery?

The idea behind the project is to serialize the JSON java function and then send it to the rabbit and then process it with celery.

Better to have sample code and you can run it directly

thanks

+3
source share
2 answers

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

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

Better to have sample code and you can run it directly

You're right.

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

+5
source

The simplest form would be to write a simple python script that simply adds the task to the celery and calls that python script from java (Runtime.exec () or a similar method).

+1
source

All Articles