pykafka.connection¶
-
class
pykafka.connection.
BrokerConnection
(host, port, buffer_size=1048576)¶ Bases:
object
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.
-
__del__
()¶ Close this connection when the object is deleted.
-
__init__
(host, port, buffer_size=1048576)¶ Initialize a socket connection to Kafka.
Parameters: - host (str) – The host to which to connect
- port (int) – The port on the host to which to connect
- buffer_size (int) – The size (in bytes) of the buffer in which to hold response data.
-
__weakref__
¶ list of weak references to the object (if defined)
-
connect
(timeout)¶ Connect to the broker.
-
connected
¶ Returns true if the socket connection is open.
-
disconnect
()¶ Disconnect from the broker.
-
reconnect
()¶ Disconnect from the broker, then reconnect
-
request
(request)¶ Send a request over the socket connection
-
response
()¶ Wait for a response from the broker
-