瀏覽代碼

Removes "publisher" alias to "producer" in the calling API (use producer)

Ask Solem 8 年之前
父節點
當前提交
54940001b5
共有 4 個文件被更改,包括 10 次插入15 次删除
  1. 0 2
      celery/app/task.py
  2. 2 2
      celery/canvas.py
  3. 6 8
      docs/userguide/calling.rst
  4. 2 3
      docs/userguide/routing.rst

+ 0 - 2
celery/app/task.py

@@ -460,8 +460,6 @@ class Task:
                 attribute.  Trailing can also be disabled by default using the
                 :attr:`trail` attribute
 
-            publisher (kombu.Producer): Deprecated alias to ``producer``.
-
             headers (Dict): Message headers to be included in the message.
 
         Returns:

+ 2 - 2
celery/canvas.py

@@ -561,7 +561,7 @@ class chain(Signature):
             dict(self.options, **options) if options else self.options))
 
     def run(self, args=(), kwargs={}, group_id=None, chord=None,
-            task_id=None, link=None, link_error=None, publisher=None,
+            task_id=None, link=None, link_error=None,
             producer=None, root_id=None, parent_id=None, app=None, **options):
         app = app or self.app
         use_link = self._use_link
@@ -1129,7 +1129,7 @@ class chord(Signature):
         return app if app is not None else current_app
 
     def apply_async(self, args=(), kwargs={}, task_id=None,
-                    producer=None, publisher=None, connection=None,
+                    producer=None, connection=None,
                     router=None, result_cls=None, **options):
         args = (tuple(args) + tuple(self.args)
                 if args and not self.immutable else self.args)

+ 6 - 8
docs/userguide/calling.rst

@@ -420,7 +420,7 @@ Connections
 .. sidebar:: Automatic Pool Support
 
     Since version 2.3 there is support for automatic connection pools,
-    so you don't have to manually handle connections and publishers
+    so you don't have to manually handle connections and producers
     to reuse connections.
 
     The connection pool is enabled by default since version 2.5.
@@ -428,18 +428,16 @@ Connections
     See the :setting:`broker_pool_limit` setting for more information.
 
 You can handle the connection manually by creating a
-publisher:
+producer:
 
 .. code-block:: python
 
 
     results = []
-    with add.app.pool.acquire(block=True) as connection:
-        with add.get_publisher(connection) as publisher:
-            try:
-                for args in numbers:
-                    res = add.apply_async((2, 2), publisher=publisher)
-                    results.append(res)
+    with add.app.producer_or_acquire() as producer:
+        for args in numbers:
+            res = add.apply_async((2, 2), producer=producer)
+            results.append(res)
     print([res.get() for res in results])
 
 

+ 2 - 3
docs/userguide/routing.rst

@@ -276,9 +276,8 @@ This is an example task message represented as a Python dictionary:
 Producers, consumers and brokers
 --------------------------------
 
-The client sending messages is typically called a *publisher*, or
-a *producer*, while the entity receiving messages is called
-a *consumer*.
+The client sending messages is typically called a *producer*,
+while the entity receiving messages is called a *consumer*.
 
 The *broker* is the message server, routing messages from producers
 to consumers.