Hands-On Microservices with Django by Tieme Woldman

Hands-On Microservices with Django by Tieme Woldman

Author:Tieme Woldman
Language: eng
Format: epub
Publisher: Packt Publishing Pvt Ltd
Published: 2024-04-02T00:00:00+00:00


Celery

Celery is an open source task queue system written in Python and available as a Python package (https://pypi.org/project/celery/). Celery runs on top of message queue brokers such as RabbitMQ and Redis, enabling producers to offload tasks asynchronously to workers.

Celery brings the tasks for both the producer and the worker together in a single tasks.py file, which leads to a Django setup like this:

Figure 6.5 – Celery-Django setup with overlapping producer and worker

Let’s walk through this setup from a Django perspective:

Producer: A user calls for a web page action via the urls.py file.

Producer: The urls.py file passes the action to the views.py file.

Producer: The views.py file links to the tasks.py file and offloads a task to a shared task microservice via Celery.Okay, so far, for the producer; now, the worker gets into action.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.