- class kafka.net.manager.KafkaConnectionManager(net, **configs)[source]
- auth_failure(node_id)[source]
Return the most recent auth-class failure for
node_id, or None if there is no sticky failure on record.
- call_soon(coro, *args)[source]
Accepts a coroutine / awaitable / function and schedules it on the event loop.
Thread-safe.
Returns: Future
- connection_delay(node_id)[source]
Connection delay in seconds.
Uses exponential backoff/retry with jitter. See KIP-144.
- least_loaded_node()[source]
Choose the node with fewest outstanding requests, with fallbacks.
This method will prefer a node with an existing connection (not throttled) with no in-flight-requests. If no such node is found, a node will be chosen randomly from all nodes that are not throttled or “blacked out” (i.e., are not subject to a reconnect backoff). If no node metadata has been obtained, will return a bootstrap node.
- Returns:
node_id or None if no suitable node was found
- run(coro, *args)[source]
Schedules coro on the event loop, blocks until complete, returns value or raises.
If an IO thread is running (via start()), the caller thread blocks on a cross-thread Event while the coroutine runs on the IO thread. Safe to call concurrently from multiple caller threads.
If no IO thread is running, falls back to driving the loop on the caller thread (legacy behavior).