diff --git a/docs/configuration.rst b/docs/configuration.rst index 49eaae9b073..169f53890d8 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -31,11 +31,7 @@ It should contain all you need to run a basic Celery set-up. CELERY_RESULT_DBURI = "sqlite:///mydatabase.db" ## Broker settings. - BROKER_HOST = "localhost" - BROKER_PORT = 5672 - BROKER_VHOST = "/" - BROKER_USER = "guest" - BROKER_PASSWORD = "guest" + BROKER_URL = "amqp://guest:guest@localhost:5672//" ## Worker settings ## If you're doing mostly I/O you can have more processes, @@ -538,6 +534,22 @@ You can use a custom transport class name, or select one of the built-in transports: ``amqplib``, ``pika``, ``redis``, ``beanstalk``, ``sqlalchemy``, ``django``, ``mongodb``, ``couchdb``. +.. setting:: BROKER_URL + +Default broker URL. This must be an URL in the format of:: + + transport://userid:password@hostname:port/virtual_host + +If this setting is defined it will override a subset of the +other ``BROKER`` options, these options are :setting:`BROKER_HOST`, +:setting:`BROKER_USER`, :setting:`BROKER_PASSWORD`, :setting:`BROKER_PORT`, +and :setting:`BROKER_VHOST`. The query part of the URL can also be used +to set options, e.g.:: + + amqp://localhost/myvhost?ssl=1 + +See the Kombu documentation for more information about broker URLs. + .. setting:: BROKER_HOST BROKER_HOST diff --git a/docs/getting-started/first-steps-with-celery.rst b/docs/getting-started/first-steps-with-celery.rst index 54e21f6cd45..5758cbaf4c7 100644 --- a/docs/getting-started/first-steps-with-celery.rst +++ b/docs/getting-started/first-steps-with-celery.rst @@ -57,11 +57,7 @@ Let's create our :file:`celeryconfig.py`. 1. Configure how we communicate with the broker (RabbitMQ in this example):: - BROKER_HOST = "localhost" - BROKER_PORT = 5672 - BROKER_USER = "myuser" - BROKER_PASSWORD = "mypassword" - BROKER_VHOST = "myvhost" + BROKER_URL = "amqp://guest:guest@localhost:5672//" 2. Define the backend used to store task metadata and return values:: diff --git a/docs/tutorials/otherqueues.rst b/docs/tutorials/otherqueues.rst index 7caa1ca96c1..83884476911 100644 --- a/docs/tutorials/otherqueues.rst +++ b/docs/tutorials/otherqueues.rst @@ -24,11 +24,12 @@ Configuration Configuration is easy, set the transport, and configure the location of your Redis database:: - BROKER_TRANSPORT = "redis" + BROKER_URL = "redis://localhost:6379/0" - BROKER_HOST = "localhost" # Maps to redis host. - BROKER_PORT = 6379 # Maps to redis port. - BROKER_VHOST = "0" # Maps to database number. + +Where the URL is in the format of:: + + redis://userid:password@hostname:port/db_number Results @@ -68,7 +69,7 @@ an SQLAlchemy database URI. #. Set your broker transport:: - BROKER_TRANSPORT = "sqlakombu.transport.Transport" + BROKER_TRANSPORT = "sqlalchemy" #. Configure the database URI:: @@ -127,7 +128,7 @@ configuration values. #. Set your broker transport:: - BROKER_TRANSPORT = "djkombu.transport.DatabaseTransport" + BROKER_TRANSPORT = "django" #. Add :mod:`djkombu` to `INSTALLED_APPS`:: diff --git a/examples/app/myapp.py b/examples/app/myapp.py index 40ca6b5e8e7..c3e02773d75 100644 --- a/examples/app/myapp.py +++ b/examples/app/myapp.py @@ -19,7 +19,7 @@ celery = Celery("myapp") -celery.conf.update(BROKER_HOST="localhost") +celery.conf.update(BROKER_URL="amqp://guest:guest@localhost:5672//") @celery.task diff --git a/examples/celery_http_gateway/settings.py b/examples/celery_http_gateway/settings.py index 6b803539017..9b3258e6e1d 100644 --- a/examples/celery_http_gateway/settings.py +++ b/examples/celery_http_gateway/settings.py @@ -5,10 +5,7 @@ CARROT_BACKEND = "amqp" CELERY_RESULT_BACKEND = "database" -BROKER_HOST = "localhost" -BROKER_VHOST = "/" -BROKER_USER = "guest" -BROKER_PASSWORD = "guest" +BROKER_URL = "amqp://guest:guest@localhost:5672//" ADMINS = ( # ('Your Name', 'your_email@domain.com'), diff --git a/examples/eventlet/celeryconfig.py b/examples/eventlet/celeryconfig.py index 04450b0d06b..ae82f73e41e 100644 --- a/examples/eventlet/celeryconfig.py +++ b/examples/eventlet/celeryconfig.py @@ -4,10 +4,7 @@ CELERYD_POOL = "eventlet" -BROKER_HOST = "localhost" -BROKER_USER = "guest" -BROKER_PASSWORD = "guest" -BROKER_VHOST = "/" +BROKER_URL = "amqp://guest:guest@localhost:5672//" CELERY_DISABLE_RATE_LIMITS = True CELERY_RESULT_BACKEND = "amqp" CELERY_TASK_RESULT_EXPIRES = 30 * 60 diff --git a/examples/gevent/celeryconfig.py b/examples/gevent/celeryconfig.py index 0990b896347..d2b264e0590 100644 --- a/examples/gevent/celeryconfig.py +++ b/examples/gevent/celeryconfig.py @@ -4,10 +4,7 @@ CELERYD_POOL = "gevent" -BROKER_HOST = "localhost" -BROKER_USER = "guest" -BROKER_PASSWORD = "guest" -BROKER_VHOST = "/" +BROKER_URL = "amqp://guest:guest@localhost:5672//" CELERY_DISABLE_RATE_LIMITS = True CELERY_RESULT_BACKEND = "amqp" CELERY_TASK_RESULT_EXPIRES = 30 * 60 diff --git a/examples/pythonproject/demoapp/celeryconfig.py b/examples/pythonproject/demoapp/celeryconfig.py index d726829bcc4..d20bc67c717 100644 --- a/examples/pythonproject/demoapp/celeryconfig.py +++ b/examples/pythonproject/demoapp/celeryconfig.py @@ -2,10 +2,7 @@ import os sys.path.insert(0, os.getcwd()) -BROKER_HOST = "localhost" -BROKER_USER = "guest" -BROKER_PASSWORD = "guest" -BROKER_VHOST = "/" +BROKER_URL = "amqp://guest:guest@localhost:5672//" CELERY_IMPORTS = ("tasks", )