kafka.net.connection

class kafka.net.connection.KafkaConnection(net, node_id=None, broker_version_data=None, **configs)[source]
DEFAULT_CONFIG = {'client_id': 'kafka-python-3.0.0', 'client_software_name': 'kafka-python', 'client_software_version': '3.0.0', 'max_in_flight_requests_per_connection': 5, 'metric_group_prefix': '', 'metrics': None, 'receive_message_max_bytes': 1000000, 'request_timeout_ms': 30000, 'sasl_kerberos_domain_name': None, 'sasl_kerberos_name': None, 'sasl_kerberos_service_name': 'kafka', 'sasl_mechanism': None, 'sasl_oauth_token_provider': None, 'sasl_plain_password': None, 'sasl_plain_username': None, 'security_protocol': 'PLAINTEXT'}
property broker_version
close(error=None)[source]
property close_future
property closed
connection_lost(exc)[source]

Called when the connection is lost or closed.

The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed).

connection_made(transport)[source]

Called when a connection is made.

The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called.

data_received(data)[source]

Called when some data is received.

eof_received()[source]

Called when the other end calls write_eof() or equivalent.

If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol.

fail_in_flight_requests(error)[source]
property init_future
async initialize(timeout_at=None)[source]
pause(v)[source]
pause_writing()[source]

Called when the transport’s buffer goes over the high-water mark.

Pause and resume calls are paired – pause_writing() is called once when the buffer goes strictly over the high-water mark (even if subsequent writes increases the buffer size even more), and eventually resume_writing() is called once when the buffer size reaches the low-water mark.

Note that if the buffer size equals the high-water mark, pause_writing() is not called – it must go strictly over. Conversely, resume_writing() is called when the buffer size is equal or lower than the low-water mark. These end conditions are important to ensure that things go as expected when either mark is zero.

NOTE: This is the only Protocol callback that is not called through EventLoop.call_soon() – if it were, it would have no effect when it’s most needed (when the app keeps writing without yielding until pause_writing() is called).

resume_writing()[source]

Called when the transport’s buffer drains below the low-water mark.

property sasl_enabled
send_buffered()[source]
send_request(request, request_timeout_ms=None)[source]
unpause(v)[source]