Browse Source

Provide BROKER_FAILOVER_STRATEGY option in Celery.

This option allows for either selecting pre-existing kombu.connection
failover strategies, or passing in your own method reference.

Conflicts:
	celery/app/base.py
	celery/tests/app/test_app.py
Matt Wise 11 years ago
parent
commit
3ded258a78
1 changed files with 20 additions and 0 deletions
  1. 20 0
      docs/configuration.rst

+ 20 - 0
docs/configuration.rst

@@ -896,6 +896,26 @@ Example::
 
 .. setting:: BROKER_TRANSPORT
 
+BROKER_FAILOVER_STRATEGY
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Default failover strategy for the broker Connection object. If supplied,
+may map to a key in 'kombu.connection.failover_strategies', or be a reference
+to any method that yields a single item from a supplied list.
+
+Example::
+
+    # Random failover strategy
+    def random_failover_strategy(servers):
+        it = list(it)  # don't modify callers list
+        shuffle = random.shuffle
+        for _ in repeat(None):
+            shuffle(it)
+            yield it[0]
+
+    BROKER_FAILOVER_STRATEGY=random_failover_strategy
+
+
 BROKER_TRANSPORT
 ~~~~~~~~~~~~~~~~
 :Aliases: ``BROKER_BACKEND``