Move docstring so it shows up in Sphinx/RTD (#952)
This commit is contained in:
@@ -41,50 +41,12 @@ log = logging.getLogger('kafka.client')
|
|||||||
|
|
||||||
class KafkaClient(object):
|
class KafkaClient(object):
|
||||||
"""
|
"""
|
||||||
A network client for asynchronous request/response network i/o.
|
A network client for asynchronous request/response network I/O.
|
||||||
This is an internal class used to implement the
|
|
||||||
user-facing producer and consumer clients.
|
This is an internal class used to implement the user-facing producer and
|
||||||
|
consumer clients.
|
||||||
|
|
||||||
This class is not thread-safe!
|
This class is not thread-safe!
|
||||||
"""
|
|
||||||
DEFAULT_CONFIG = {
|
|
||||||
'bootstrap_servers': 'localhost',
|
|
||||||
'client_id': 'kafka-python-' + __version__,
|
|
||||||
'request_timeout_ms': 40000,
|
|
||||||
'reconnect_backoff_ms': 50,
|
|
||||||
'max_in_flight_requests_per_connection': 5,
|
|
||||||
'receive_buffer_bytes': None,
|
|
||||||
'send_buffer_bytes': None,
|
|
||||||
'socket_options': [(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)],
|
|
||||||
'retry_backoff_ms': 100,
|
|
||||||
'metadata_max_age_ms': 300000,
|
|
||||||
'security_protocol': 'PLAINTEXT',
|
|
||||||
'ssl_context': None,
|
|
||||||
'ssl_check_hostname': True,
|
|
||||||
'ssl_cafile': None,
|
|
||||||
'ssl_certfile': None,
|
|
||||||
'ssl_keyfile': None,
|
|
||||||
'ssl_password': None,
|
|
||||||
'ssl_crlfile': None,
|
|
||||||
'api_version': None,
|
|
||||||
'api_version_auto_timeout_ms': 2000,
|
|
||||||
'selector': selectors.DefaultSelector,
|
|
||||||
'metrics': None,
|
|
||||||
'metric_group_prefix': '',
|
|
||||||
'sasl_mechanism': None,
|
|
||||||
'sasl_plain_username': None,
|
|
||||||
'sasl_plain_password': None,
|
|
||||||
}
|
|
||||||
API_VERSIONS = [
|
|
||||||
(0, 10),
|
|
||||||
(0, 9),
|
|
||||||
(0, 8, 2),
|
|
||||||
(0, 8, 1),
|
|
||||||
(0, 8, 0)
|
|
||||||
]
|
|
||||||
|
|
||||||
def __init__(self, **configs):
|
|
||||||
"""Initialize an asynchronous kafka client
|
|
||||||
|
|
||||||
Keyword Arguments:
|
Keyword Arguments:
|
||||||
bootstrap_servers: 'host[:port]' string (or list of 'host[:port]'
|
bootstrap_servers: 'host[:port]' string (or list of 'host[:port]'
|
||||||
@@ -164,6 +126,44 @@ class KafkaClient(object):
|
|||||||
sasl_plain_password (str): password for sasl PLAIN authentication.
|
sasl_plain_password (str): password for sasl PLAIN authentication.
|
||||||
Default: None
|
Default: None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
DEFAULT_CONFIG = {
|
||||||
|
'bootstrap_servers': 'localhost',
|
||||||
|
'client_id': 'kafka-python-' + __version__,
|
||||||
|
'request_timeout_ms': 40000,
|
||||||
|
'reconnect_backoff_ms': 50,
|
||||||
|
'max_in_flight_requests_per_connection': 5,
|
||||||
|
'receive_buffer_bytes': None,
|
||||||
|
'send_buffer_bytes': None,
|
||||||
|
'socket_options': [(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)],
|
||||||
|
'retry_backoff_ms': 100,
|
||||||
|
'metadata_max_age_ms': 300000,
|
||||||
|
'security_protocol': 'PLAINTEXT',
|
||||||
|
'ssl_context': None,
|
||||||
|
'ssl_check_hostname': True,
|
||||||
|
'ssl_cafile': None,
|
||||||
|
'ssl_certfile': None,
|
||||||
|
'ssl_keyfile': None,
|
||||||
|
'ssl_password': None,
|
||||||
|
'ssl_crlfile': None,
|
||||||
|
'api_version': None,
|
||||||
|
'api_version_auto_timeout_ms': 2000,
|
||||||
|
'selector': selectors.DefaultSelector,
|
||||||
|
'metrics': None,
|
||||||
|
'metric_group_prefix': '',
|
||||||
|
'sasl_mechanism': None,
|
||||||
|
'sasl_plain_username': None,
|
||||||
|
'sasl_plain_password': None,
|
||||||
|
}
|
||||||
|
API_VERSIONS = [
|
||||||
|
(0, 10),
|
||||||
|
(0, 9),
|
||||||
|
(0, 8, 2),
|
||||||
|
(0, 8, 1),
|
||||||
|
(0, 8, 0)
|
||||||
|
]
|
||||||
|
|
||||||
|
def __init__(self, **configs):
|
||||||
self.config = copy.copy(self.DEFAULT_CONFIG)
|
self.config = copy.copy(self.DEFAULT_CONFIG)
|
||||||
for key in self.config:
|
for key in self.config:
|
||||||
if key in configs:
|
if key in configs:
|
||||||
|
Reference in New Issue
Block a user