Skip to content

Commit 4a32205

Browse files
dpkp88manpreet
authored andcommitted
Add ClusterMetadata documentation
1 parent 62b2942 commit 4a32205

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

docs/apidoc/ClusterMetadata.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ClusterMetadata
2+
===========
3+
4+
.. autoclass:: kafka.cluster.ClusterMetadata
5+
:members:

docs/apidoc/kafka.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@ Subpackages
66

77
.. toctree::
88

9+
kafka.cluster
910
kafka.consumer
1011
kafka.partitioner
1112
kafka.producer
1213

1314
Submodules
1415
----------
1516

17+
kafka.cluster module
18+
--------------------
19+
20+
.. automodule:: kafka.cluster
21+
:members:
22+
:undoc-members:
23+
:show-inheritance:
24+
25+
1626
kafka.client module
1727
-------------------
1828

docs/apidoc/modules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ kafka-python API
77
KafkaProducer
88
KafkaClient
99
BrokerConnection
10+
ClusterMetadata

kafka/client_async.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class KafkaClient(object):
4848
4949
This class is not thread-safe!
5050
51+
Attributes:
52+
cluster (:any:`ClusterMetadata`): Local cache of cluster metadata, retrived
53+
via MetadataRequests during :meth:`.poll`.
54+
5155
Keyword Arguments:
5256
bootstrap_servers: 'host[:port]' string (or list of 'host[:port]'
5357
strings) that the consumer should contact to bootstrap initial

kafka/cluster.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
1616

1717

1818
class ClusterMetadata(object):
19+
"""
20+
A class to manage kafka cluster metadata.
21+
22+
This class does not perform any IO. It simply updates internal state
23+
given API responses (MetadataResponse, GroupCoordinatorResponse).
24+
25+
Keyword Arguments:
26+
retry_backoff_ms (int): Milliseconds to backoff when retrying on
27+
errors. Default: 100.
28+
metadata_max_age_ms (int): The period of time in milliseconds after
29+
which we force a refresh of metadata even if we haven't seen any
30+
partition leadership changes to proactively discover any new
31+
brokers or partitions. Default: 300000
32+
"""
1933
DEFAULT_CONFIG = {
2034
'retry_backoff_ms': 100,
2135
'metadata_max_age_ms': 300000,

0 commit comments

Comments
 (0)