Ver Fonte

Examples now use broker URL. sqlakombu is currently broken though, need to find a solutionf or that

Ask Solem há 13 anos atrás
pai
commit
62647576d4

+ 17 - 5
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

+ 1 - 5
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::
 

+ 7 - 6
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`::
 

+ 1 - 1
examples/app/myapp.py

@@ -19,7 +19,7 @@ from celery import Celery
 
 
 celery = Celery("myapp")
-celery.conf.update(BROKER_HOST="localhost")
+celery.conf.update(BROKER_URL="amqp://guest:guest@localhost:5672//")
 
 
 @celery.task

+ 1 - 4
examples/celery_http_gateway/settings.py

@@ -5,10 +5,7 @@ TEMPLATE_DEBUG = DEBUG
 
 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'),

+ 1 - 4
examples/eventlet/celeryconfig.py

@@ -4,10 +4,7 @@ sys.path.insert(0, os.getcwd())
 
 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

+ 1 - 4
examples/gevent/celeryconfig.py

@@ -4,10 +4,7 @@ sys.path.insert(0, os.getcwd())
 
 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

+ 1 - 4
examples/pythonproject/demoapp/celeryconfig.py

@@ -2,10 +2,7 @@ import sys
 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", )