buz 2.19.0__py3-none-any.whl → 2.20.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- buz/kafka/domain/exceptions/consumer_group_not_found_exception.py +6 -0
- buz/kafka/domain/services/kafka_admin_client.py +8 -0
- buz/kafka/infrastructure/kafka_python/kafka_python_admin_client.py +26 -0
- {buz-2.19.0.dist-info → buz-2.20.0.dist-info}/METADATA +1 -1
- {buz-2.19.0.dist-info → buz-2.20.0.dist-info}/RECORD +7 -6
- {buz-2.19.0.dist-info → buz-2.20.0.dist-info}/LICENSE +0 -0
- {buz-2.19.0.dist-info → buz-2.20.0.dist-info}/WHEEL +0 -0
|
@@ -65,3 +65,11 @@ class KafkaAdminClient(ConnectionManager, ABC):
|
|
|
65
65
|
new_number_of_partitions: int,
|
|
66
66
|
) -> None:
|
|
67
67
|
pass
|
|
68
|
+
|
|
69
|
+
@abstractmethod
|
|
70
|
+
def get_consumer_group_offsets(self, *, consumer_group: str, topic: str) -> dict[int, int]:
|
|
71
|
+
"""
|
|
72
|
+
Get the committed offsets for a consumer group on a specific topic.
|
|
73
|
+
Returns a dictionary mapping partition numbers to their committed offsets.
|
|
74
|
+
"""
|
|
75
|
+
pass
|
|
@@ -12,6 +12,7 @@ from kafka.admin.new_partitions import NewPartitions
|
|
|
12
12
|
from kafka.errors import TopicAlreadyExistsError
|
|
13
13
|
from kafka.structs import TopicPartition, OffsetAndTimestamp
|
|
14
14
|
|
|
15
|
+
from buz.kafka.domain.exceptions.consumer_group_not_found_exception import ConsumerGroupNotFoundException
|
|
15
16
|
from buz.kafka.domain.exceptions.not_all_partition_assigned_exception import NotAllPartitionAssignedException
|
|
16
17
|
from buz.kafka.domain.exceptions.not_valid_partition_number_exception import NotValidPartitionNumberException
|
|
17
18
|
from buz.kafka.domain.exceptions.topic_already_created_exception import KafkaTopicsAlreadyCreatedException
|
|
@@ -400,3 +401,28 @@ class KafkaPythonAdminClient(KafkaAdminClient):
|
|
|
400
401
|
related_consumer_groups.add(consumer_group)
|
|
401
402
|
|
|
402
403
|
return related_consumer_groups
|
|
404
|
+
|
|
405
|
+
def get_consumer_group_offsets(self, *, consumer_group: str, topic: str) -> dict[int, int]:
|
|
406
|
+
self._logger.info(f'Getting consumer group offsets for group "{consumer_group}" on topic "{topic}"')
|
|
407
|
+
|
|
408
|
+
if not self.is_topic_created(topic):
|
|
409
|
+
raise TopicNotFoundException(topic_name=topic)
|
|
410
|
+
|
|
411
|
+
cluster_consumer_groups = self.get_cluster_consumer_groups()
|
|
412
|
+
if consumer_group not in cluster_consumer_groups:
|
|
413
|
+
raise ConsumerGroupNotFoundException(consumer_group=consumer_group)
|
|
414
|
+
|
|
415
|
+
partitions = self.get_number_of_partitions(topic)
|
|
416
|
+
topic_partitions = [TopicPartition(topic=topic, partition=partition) for partition in range(partitions)]
|
|
417
|
+
|
|
418
|
+
offsets_response = self._get_kafka_admin().list_consumer_group_offsets(
|
|
419
|
+
consumer_group, partitions=topic_partitions
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
# Build the result dictionary, filtering out partitions with no committed offset (-1)
|
|
423
|
+
result: dict[int, int] = {}
|
|
424
|
+
for topic_partition, offset_and_metadata in offsets_response.items():
|
|
425
|
+
if offset_and_metadata.offset >= 0:
|
|
426
|
+
result[topic_partition.partition] = offset_and_metadata.offset
|
|
427
|
+
|
|
428
|
+
return result
|
|
@@ -148,6 +148,7 @@ buz/event/worker.py,sha256=BL9TXB_kyr0Avql9fIcFm3CDNnXPvZB6O6BxVwjtCdA,942
|
|
|
148
148
|
buz/handler.py,sha256=W6jSTo5BNV9u9QKBaEMhLIa3tgQocd6oYEJf5K4EfEU,358
|
|
149
149
|
buz/kafka/__init__.py,sha256=R3fcyET-SNEAvk_XlBQbHIbQVb63Qiz6lVrif3nDhNU,3435
|
|
150
150
|
buz/kafka/domain/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
151
|
+
buz/kafka/domain/exceptions/consumer_group_not_found_exception.py,sha256=8My8lM7DZ7JARfHY1MmuW5BWOB1YadiKhnc3cSTPlaI,225
|
|
151
152
|
buz/kafka/domain/exceptions/not_all_partition_assigned_exception.py,sha256=1Ky6gDh_baD6cGB0MBnjbkkLcw2zQU_kFXPpDZn56z0,400
|
|
152
153
|
buz/kafka/domain/exceptions/not_valid_kafka_message_exception.py,sha256=Dn6I_-eGQnOuu5WW24oKGOdKOu4EdM8ByH3DLAbz5SY,57
|
|
153
154
|
buz/kafka/domain/exceptions/not_valid_partition_number_exception.py,sha256=YZyGbblHk6ON9sBtjRQTDa-nC88i4oe14_VSO8vSTm0,337
|
|
@@ -168,7 +169,7 @@ buz/kafka/domain/models/kafka_supported_sasl_mechanisms.py,sha256=ASyDaFgseQRcUJ
|
|
|
168
169
|
buz/kafka/domain/models/kafka_supported_security_protocols.py,sha256=ffY2-9sOj4XIkJTSQVkqeOb4KnuqEYXISDarfDN8r9Q,161
|
|
169
170
|
buz/kafka/domain/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
170
171
|
buz/kafka/domain/services/async_kafka_producer.py,sha256=gSq3WwEVux_gp3EKDAMN1WsM027uklB58E-WnKpyhPs,533
|
|
171
|
-
buz/kafka/domain/services/kafka_admin_client.py,sha256=
|
|
172
|
+
buz/kafka/domain/services/kafka_admin_client.py,sha256=gjLs7BZwRjBd6qEoL2bNUdpHGPkh51dw1-kmC6I2YHw,1871
|
|
172
173
|
buz/kafka/domain/services/kafka_admin_test_client.py,sha256=91l_vFIo1yhJLQQCC_OmeXZ5F429zP7Hx5g4FNllpfE,1625
|
|
173
174
|
buz/kafka/domain/services/kafka_producer.py,sha256=8bLTV328orrPHcARzkc6no4vyJzrArVtCsjmSRXDjos,506
|
|
174
175
|
buz/kafka/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -198,7 +199,7 @@ buz/kafka/infrastructure/interfaces/async_connection_manager.py,sha256=JbaLu5UVV
|
|
|
198
199
|
buz/kafka/infrastructure/interfaces/connection_manager.py,sha256=EWnvShJHOg8QYe6a3ma0urjKjmVMDBi7q8T2cv_i_MQ,200
|
|
199
200
|
buz/kafka/infrastructure/kafka_python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
200
201
|
buz/kafka/infrastructure/kafka_python/exception/consumer_interrupted_exception.py,sha256=fqhgV7HILdVdv-p1CsOIaaESKY2ZXBtRGYbrVSdPLg0,164
|
|
201
|
-
buz/kafka/infrastructure/kafka_python/kafka_python_admin_client.py,sha256=
|
|
202
|
+
buz/kafka/infrastructure/kafka_python/kafka_python_admin_client.py,sha256=FRO_zmGdOkiu5wFYmO7v-hLASxR0XT45uDqjHgmg_F4,17544
|
|
202
203
|
buz/kafka/infrastructure/kafka_python/kafka_python_admin_test_client.py,sha256=5xP23dQ7FDuy7dIWNw39C3bMVmaUj9ZQhEEJISRv9ec,2986
|
|
203
204
|
buz/kafka/infrastructure/kafka_python/kafka_python_producer.py,sha256=DkqqLSSXHBf4SXXf-IZwwLhxWrGE95Jg4MO_3RDsikU,3594
|
|
204
205
|
buz/kafka/infrastructure/kafka_python/translators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -262,7 +263,7 @@ buz/serializer/message_to_json_bytes_serializer.py,sha256=RGZJ64t4t4Pz2FCASZZCv-
|
|
|
262
263
|
buz/wrapper/__init__.py,sha256=GnRdJFcncn-qp0hzDG9dBHLmTJSbHFVjE_yr-MdW_n4,77
|
|
263
264
|
buz/wrapper/async_to_sync.py,sha256=OfK-vrVUhuN-LLLvekLdMbQYtH0ue5lfbvuasj6ovMI,698
|
|
264
265
|
buz/wrapper/event_loop.py,sha256=pfBJ1g-8A2a3YgW8Gf9Fg0kkewoh3-wgTy2KIFDyfHk,266
|
|
265
|
-
buz-2.
|
|
266
|
-
buz-2.
|
|
267
|
-
buz-2.
|
|
268
|
-
buz-2.
|
|
266
|
+
buz-2.20.0.dist-info/LICENSE,sha256=jcLgcIIVaBqaZNwe0kzGWSU99YgwMcI0IGv142wkYSM,1062
|
|
267
|
+
buz-2.20.0.dist-info/METADATA,sha256=G6e8B1zuAsgMDYnD6b4yJY3oS5bgRBzWdTq-Qrk-KPU,12580
|
|
268
|
+
buz-2.20.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
269
|
+
buz-2.20.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|