summaryrefslogtreecommitdiff
path: root/kafka/client_async.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-07-16 23:11:17 -0700
committerGitHub <noreply@github.com>2016-07-16 23:11:17 -0700
commit506d023978e7273bd323c0750e3f77af259d257b (patch)
tree0365f1861286bc82fdccc99dc6c867a353de7b2b /kafka/client_async.py
parent43bbdf1434615390800783fc8da56000cf9acd10 (diff)
downloadkafka-python-506d023978e7273bd323c0750e3f77af259d257b.tar.gz
Expose selector type as config option (#764)
Diffstat (limited to 'kafka/client_async.py')
-rw-r--r--kafka/client_async.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py
index 2700069..9439451 100644
--- a/kafka/client_async.py
+++ b/kafka/client_async.py
@@ -64,6 +64,7 @@ class KafkaClient(object):
'ssl_crlfile': None,
'api_version': None,
'api_version_auto_timeout_ms': 2000,
+ 'selector': selectors.DefaultSelector,
}
API_VERSIONS = [
(0, 10),
@@ -135,6 +136,9 @@ class KafkaClient(object):
api_version_auto_timeout_ms (int): number of milliseconds to throw a
timeout exception from the constructor when checking the broker
api version. Only applies if api_version is None
+ selector (selectors.BaseSelector): Provide a specific selector
+ implementation to use for I/O multiplexing.
+ Default: selectors.DefaultSelector
"""
self.config = copy.copy(self.DEFAULT_CONFIG)
for key in self.config:
@@ -150,7 +154,7 @@ class KafkaClient(object):
self._topics = set() # empty set will fetch all topic metadata
self._metadata_refresh_in_progress = False
self._last_no_node_available_ms = 0
- self._selector = selectors.DefaultSelector()
+ self._selector = self.config['selector']()
self._conns = {}
self._connecting = set()
self._refresh_on_disconnects = True