BrokerConnection(host, port, handler, buffer_size=1048576, source_host='', source_port=0)¶
BrokerConnection thinly wraps a socket.create_connection call and handles the sending and receiving of data that conform to the kafka binary protocol over that socket.
Close this connection when the object is deleted.
__init__(host, port, handler, buffer_size=1048576, source_host='', source_port=0)¶
Initialize a socket connection to Kafka.
- host (str) – The host to which to connect
- port (int) – The port on the host to which to connect
- handler (
pykafka.handlers.Handler) – The
pykafka.handlers.Handlerinstance to use when creating a connection
- buffer_size (int) – The size (in bytes) of the buffer in which to hold response data.
- source_host (str) – The host portion of the source address for the socket connection
- source_port (int) – The port portion of the source address for the socket connection
list of weak references to the object (if defined)
Connect to the broker.
Returns true if the socket connection is open.
Disconnect from the broker.
Disconnect from the broker, then reconnect
Send a request over the socket connection
Wait for a response from the broker