In our app we have a Rails app that makes an API call to a Flask API. The API then schedules a task, and we are using Redis as the queue.
@app.route("/api/article", methods=["POST"])def api_article(): app.logger.info("[route] /api/article") . . res_id = celery.send_task("tasks.text_stats", args=[article], kwargs={}).id
@celery.task(name="tasks.text_stats")def text_stats(article): logger.info("text_stats")
What I am thinking is if the Redis database is accessible to both Rails and Flask, we could just create the task directly in Redis, which would then be picked up by the Celery worker.
Questions:
- How to create a Celery job in Redis using Ruby?
- Are there any Ruby libraries which would support this?