Search code examples
djangorabbitmqdjango-celery

Django-celery task being serviced by wrong running instance


I've got a Django app that uses django-celery with a rabbitmq backend. We have a test machine where different users are running the same Django app in their own accounts (each listening on a different port), but all are using identical settings.py files, and therefore the same rabbitmq credentials, to connect celery to the back-end. (Note that they're each using a different sqlite database for the db backend).

I just discovered that we may be getting "crosstalk" among the django-celery tasks, that a task request from the django app in user A's account might be being serviced by a celery task running in user B's account.

What's the simplest way to configure things to avoid this problem? Do I need to create separate rabbitmq accounts and/or vhosts for each user? Or is there some other way to do this?


Solution

  • The simplest way is to have separate vhosts for each environment. You could still share the same RabbitMQ user.