summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRudy Attias <rudy.attias@gmail.com>2019-10-06 23:36:05 +0300
committerAsif Saif Uddin <auvipy@gmail.com>2020-09-06 07:43:31 +0600
commitd440278cd3277060bb80d84234e5ab173f50a885 (patch)
tree1480825dd3bc0843c14452f36f5ebf7eeb40aa09
parenteff1717266f8dec67c18dfdac1111bed23aebd4b (diff)
downloadkombu-d440278cd3277060bb80d84234e5ab173f50a885.tar.gz
Added redis transport key_prefix from envvars
-rw-r--r--kombu/transport/redis.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/kombu/transport/redis.py b/kombu/transport/redis.py
index 3dca36db..67978547 100644
--- a/kombu/transport/redis.py
+++ b/kombu/transport/redis.py
@@ -1,5 +1,6 @@
"""Redis transport."""
+import os
import numbers
import socket
@@ -55,6 +56,10 @@ Cannot route message for exchange {0!r}: Table empty or key no longer exists.
Probably the key ({1!r}) has been removed from the Redis database.
"""
+KEY_PREFIX = os.environ.get('KOMBU_REDIS_PREFIX', '')
+if KEY_PREFIX:
+ KEY_PREFIX = '{p}:'.format(p=KEY_PREFIX)
+
# This implementation may seem overly complex, but I assure you there is
# a good reason for doing it this way.
#
@@ -403,16 +408,16 @@ class Channel(virtual.Channel):
_subclient = None
_closing = False
supports_fanout = True
- keyprefix_queue = '_kombu.binding.%s'
+ keyprefix_queue = '{p}_kombu.binding.%s'.format(p=KEY_PREFIX)
keyprefix_fanout = '/{db}.'
sep = '\x06\x16'
_in_poll = False
_in_listen = False
_fanout_queues = {}
ack_emulation = True
- unacked_key = 'unacked'
- unacked_index_key = 'unacked_index'
- unacked_mutex_key = 'unacked_mutex'
+ unacked_key = '{p}unacked'.format(p=KEY_PREFIX)
+ unacked_index_key = '{p}unacked_index'.format(p=KEY_PREFIX)
+ unacked_mutex_key = '{p}unacked_mutex'.format(p=KEY_PREFIX)
unacked_mutex_expire = 300 # 5 minutes
unacked_restore_limit = None
visibility_timeout = 3600 # 1 hour