BrokerConnection

class kafka.BrokerConnection(host, port, afi, **configs)
blacked_out()

Return true if we are disconnected from the given node and can’t re-establish a connection yet

can_send_more()

Return True unless there are max_in_flight_requests.

check_version(timeout=2, strict=False)

Attempt to guess the broker version. This is a blocking call.

close(error=None)

Close socket and fail all in-flight-requests.

Parameters:error (Exception, optional) – pending in-flight-requests will be failed with this exception. Default: kafka.errors.ConnectionError.
connect()

Attempt to connect and return ConnectionState

connected()

Return True iff socket is connected.

connecting()

Returns True if still connecting (this may encompass several different states, such as SSL handshake, authorization, etc).

disconnected()

Return True iff socket is closed

recv()

Non-blocking network receive.

Return response if available

send(request, expect_response=True)

send request, return Future()

Can block on network if request is larger than send_buffer_bytes