kiel.clients.client

class kiel.clients.client.Client(brokers)[source]

Bases: object

Base class for all client classes.

Handles basic cluster management and request sending.

connect(*args, **kwargs)[source]

Starts the underlying cluster, connecting and gathering metadata.

close(*args, **kwargs)[source]

Marks a client as closing and winds down connections.

Calls the wind_down() coroutine that subclasses must implement.

wind_down(*args, **kwargs)[source]

Cleanup method left to subclasses to define.

Called by close(), should clean up any subclass-specific resources.

send(*args, **kwargs)[source]

Sends a dict of requests keyed on broker ID and handles responses.

Returns a dictionary of the results of handle_<response.api>_response method calls, keyed to the corresponding broker ID.

Raises UnhandledResponseError if the client subclass does not have a handle_<response.api>_response method available to handle an incoming response object.

If an error occurs in a response, the heal_cluster flag is set and the heal() method on the cluster is called after processing each response.

Responses are handled in the order they come in, but this method does not yield a value until all responses are handled.