Reputation: 420
I use Django and Django Rest Framework for my internal API and I use Vue.js for my frontend. The backend (API) and the frontend are totally separated.
I need to run a background task (every time a user is created) and I am considering 2 solutions:
Note that this function will call a 3rd party API. The call might fail for various reasons and/or run during a long period ~20sec.
With Redis or RabbitMQ or django-background-tasks.
Which solution should I go for ? If both solutions are acceptable, what would be the limitations/advantages of each one ?
Upvotes: 0
Views: 334
Reputation: 106
You might need django celery. This is a great package for background tasks for django, you can choose either Redis or RabbitMQ as the broker, where the brokers doesn't matter much on my opinion.
Why can this be a good solution for your problem?
from celery import shared_task
@shared_task
def add(x,y):
return X+y
and call it anywhere in you code
add.delay()
you know how background task.
Upvotes: 0