Alejandro Veintimilla
Alejandro Veintimilla

Reputation: 11523

Find RabbitMQ BROKER_URL

this question may be too obvious, but this is the first time I work with Celery and RabbitMQ or anything similar. I need to declare my BROKER_URL somewhere, but I don't even know how to find it.. where is it? on the terminal I write sudo rabbitmq-server and I can see rabbitmq is running.

Upvotes: 1

Views: 2629

Answers (1)

Kurt Raschke
Kurt Raschke

Reputation: 980

I'll assume you have followed the Celery First Steps with Django tutorial. The structure provided by that tutorial (and specifically the line app.config_from_object('django.conf:settings')) in celery.py configures Celery to read its settings from the Django configuration. So, any Celery settings, like BROKER_URL, CELERY_RESULT_BACKEND, or others can be configured simply by including them in your Django project's settings.py file.

However, this is probably all irrelevant! As the documentation for the BROKER_URL parameter indicates, "[the] transport part [of the URL] is the broker implementation to use, and the default is amqp...", and as the documentation for the underlying messaging library (Kombu) states, "[a] connection without options will use the default connection settings, which is using the localhost host, default port, user name guest, password guest and virtual host '/'".

What does all of this mean? In short, it should work out-of-the-box, assuming you are running RabbitMQ on the same computer as your Celery project, and assuming you haven't changed RabbitMQ's settings (i.e. port number, authentication, etc.). Without a BROKER_URL set, Celery will use its default settings, which would have it connect to an AMQP server (i.e. RabbitMQ) on the same computer, using the default guest credentials.

Upvotes: 2

Related Questions