Calling Celery Tasks not from Python
Celery is probably the most popular task queue/job queue in Python.
Often you call Celery tasks from Python code. But! You can have a situation when you need to run Celery tasks from another language. The obvious solution is to have a web server (Flask / Django / etc) neer to your Celery code and execute tasks through API calls. But! This is not the ultimate solution.
One of my projects at the current job uses Java Netflix stack for the microservices architecture. It uses Netflix Eureka for the service discovery. So, your Python service should be there too. And here is the problem, cause it is quite difficult to do. Yeah, there are some repos on Github that gives you some kind of integration, but it is not enough. If you have some another reason not to use API in this kind of a situation, you can write it down in comments :)
So, our solution is to use Celery bootsteps. You can override the method that is responsible for the input message handling. We’ll be using RabbitMQ as a message broker.
Basically, in our example, Celery bootsteps are like the middle part of the Java application and your Celery tasks.
Now, it is time to look at the code.