This POC intends to demonstrate the usage of task queues.
-
The frontend has a button which sends a post request to server with a
delayfield. -
The backend creates a Celery task which simulates a delay. It waits for
delayseconds before getting completed. -
The backend exposes two endpoints. One for creating a task, returning the
task_id. Another to get the status a respective task. A task can either bein_progressor becompleted. -
Frontend uses a technique called
pollingto fetch progress of the active task. A progress bar is rendered for visualization. -
Finally, a done message is shown when the task reaches the
completedstate.
-
For the frontend, it uses React along with Axios to make the http requests.
-
The backend uses
Fastapialong withCeleryas the Task Queue. -
Redisis used both as a message broker and the result backend for our current implementation. -
Floweris used to monitor the tasks, workers and the whole Task Queue system.