Can I use java send task to celery through rabbitmq?

前端 未结 2 793
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-20 21:22

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

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

I

相关标签:
2条回答
  • 2021-01-20 21:54

    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

    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

    You are correct.

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

    0 讨论(0)
  • 2021-01-20 21:54

    Simplest form would be to write a simple python script which simply adds a task to celery, and call this python script from java (Runtime.exec() or similar method).

    0 讨论(0)
提交回复
热议问题