Skip to content

Commit d902d7f

Browse files
author
Wayde
committed
add function bootstrap_connected
1 parent 3f3a257 commit d902d7f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

kafka/consumer/group.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,12 @@ def __init__(self, *topics, **configs):
377377
self._subscription.subscribe(topics=topics)
378378
self._client.set_topics(topics)
379379

380+
def bootstrap_connected(self):
381+
"""Return True if the bootstrap is connected."""
382+
if self._client._bootstrap_fails > 0:
383+
return False
384+
return True
385+
380386
def assign(self, partitions):
381387
"""Manually assign a list of TopicPartitions to this consumer.
382388

kafka/producer/kafka.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,12 @@ def __init__(self, **configs):
402402
atexit.register(self._cleanup)
403403
log.debug("Kafka producer started")
404404

405+
def bootstrap_connected(self):
406+
"""Return True if the bootstrap is connected."""
407+
if self._client._bootstrap_fails > 0:
408+
return False
409+
return True
410+
405411
def _cleanup_factory(self):
406412
"""Build a cleanup clojure that doesn't increase our ref count"""
407413
_self = weakref.proxy(self)

0 commit comments

Comments
 (0)