瀏覽代碼

Merge pull request #3002 from jbkkd/master

Add example for broadcast queue and celerybeat
Ask Solem Hoel 9 年之前
父節點
當前提交
136c154128
共有 1 個文件被更改,包括 18 次插入0 次删除
  1. 18 0
      docs/userguide/routing.rst

+ 18 - 0
docs/userguide/routing.rst

@@ -598,6 +598,24 @@ copies of tasks to all workers connected to it:
 Now the ``tasks.reload_cache`` task will be sent to every
 worker consuming from this queue.
 
+Here is another example of broadcast routing, this time with
+a celerybeat schedule:
+
+.. code-block:: python
+
+    from kombu.common import Broadcast
+    from celery.schedules import crontab
+
+    task_queues = (Broadcast('broadcast_tasks'),)
+
+    beat_schedule = {'test-task': {
+            'task': 'tasks.reload_cache',
+            'schedule': crontab(minute=0, hour='*/3'),
+            'options': {'exchange': 'broadcast_tasks'}
+        },
+    }
+
+
 .. admonition:: Broadcast & Results
 
     Note that Celery result does not define what happens if two