buz 2.13.1rc3__py3-none-any.whl → 2.13.1rc4__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/event/infrastructure/buz_kafka/base_buz_aiokafka_async_consumer.py +16 -5
- {buz-2.13.1rc3.dist-info → buz-2.13.1rc4.dist-info}/METADATA +1 -1
- {buz-2.13.1rc3.dist-info → buz-2.13.1rc4.dist-info}/RECORD +5 -5
- {buz-2.13.1rc3.dist-info → buz-2.13.1rc4.dist-info}/LICENSE +0 -0
- {buz-2.13.1rc3.dist-info → buz-2.13.1rc4.dist-info}/WHEEL +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from abc import abstractmethod
|
|
2
2
|
import traceback
|
|
3
|
-
from asyncio import Lock, gather, Semaphore, Event as AsyncIOEvent, sleep
|
|
3
|
+
from asyncio import Lock, create_task, gather, Semaphore, Event as AsyncIOEvent, sleep
|
|
4
4
|
from datetime import timedelta, datetime
|
|
5
5
|
from itertools import cycle
|
|
6
6
|
from logging import Logger
|
|
@@ -89,7 +89,7 @@ class BaseBuzAIOKafkaAsyncConsumer(AsyncConsumer):
|
|
|
89
89
|
start_time = datetime.now()
|
|
90
90
|
await self.__generate_kafka_consumers()
|
|
91
91
|
|
|
92
|
-
if len(self.
|
|
92
|
+
if len(self.__executor_per_consumer_mapper) == 0:
|
|
93
93
|
self._logger.error("There are no valid subscribers to execute, finalizing consumer")
|
|
94
94
|
return
|
|
95
95
|
|
|
@@ -163,13 +163,24 @@ class BaseBuzAIOKafkaAsyncConsumer(AsyncConsumer):
|
|
|
163
163
|
on_partition_revoked=self.__on_partition_revoked,
|
|
164
164
|
)
|
|
165
165
|
|
|
166
|
-
self.__subscriber_per_consumer_mapper[kafka_consumer] = subscriber
|
|
167
|
-
|
|
168
166
|
self.__executor_per_consumer_mapper[kafka_consumer] = executor
|
|
169
167
|
|
|
170
168
|
self.__queue_per_consumer_mapper[kafka_consumer] = InMemoryMultiqueueRepository()
|
|
171
169
|
|
|
172
|
-
|
|
170
|
+
# The purpose of this block is to initialize the consumer without delay the execution of the polling thread
|
|
171
|
+
# If some of the subscribers haven't as many partitions as subscriber they will not be able to be initialized
|
|
172
|
+
# (but maybe they should be initialized in the future)
|
|
173
|
+
create_task(self.__init_consumer(kafka_consumer, subscriber))
|
|
174
|
+
except Exception:
|
|
175
|
+
self._logger.exception(
|
|
176
|
+
f"Unexpected error during Kafka subscriber '{subscriber.fqn()}' creation. Skipping it: {traceback.format_exc()}"
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
async def __init_consumer(self, consumer: AIOKafkaConsumer, subscriber: MetaSubscriber) -> None:
|
|
180
|
+
try:
|
|
181
|
+
await consumer.init()
|
|
182
|
+
self.__subscriber_per_consumer_mapper[consumer] = subscriber
|
|
183
|
+
self._logger.info(f"initialized '{subscriber.fqn()}'")
|
|
173
184
|
except Exception:
|
|
174
185
|
self._logger.exception(
|
|
175
186
|
f"Unexpected error during Kafka subscriber '{subscriber.fqn()}' initialization. Skipping it: {traceback.format_exc()}"
|
|
@@ -45,7 +45,7 @@ buz/event/exceptions/term_signal_interruption_exception.py,sha256=RkRRF0v_K9Hg48
|
|
|
45
45
|
buz/event/exceptions/worker_execution_exception.py,sha256=6mgztvXOCG_9VZ_Jptkk72kZtNWQ2CPuQ3TjXEWFE14,123
|
|
46
46
|
buz/event/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
47
|
buz/event/infrastructure/buz_kafka/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
buz/event/infrastructure/buz_kafka/base_buz_aiokafka_async_consumer.py,sha256=
|
|
48
|
+
buz/event/infrastructure/buz_kafka/base_buz_aiokafka_async_consumer.py,sha256=Jk69FKc5OmYC0CKx-rZMpqyCWtOMqLTR35Jwukk-QLE,14630
|
|
49
49
|
buz/event/infrastructure/buz_kafka/buz_aiokafka_async_consumer.py,sha256=dqQDv7taAmINE9G2geMDExbcvSlntP09_rQ0JRbc4Rw,5507
|
|
50
50
|
buz/event/infrastructure/buz_kafka/buz_aiokafka_multi_threaded_consumer.py,sha256=yrEU51OBjvLjCfYJFJPxux1bcIhoTVMw1Jf0HJMWbb0,5449
|
|
51
51
|
buz/event/infrastructure/buz_kafka/buz_kafka_event_bus.py,sha256=f94fmS4AVfb3LQsp49e-4Cqzj00IqxHDzuUvDbN4u2s,4258
|
|
@@ -230,7 +230,7 @@ buz/serializer/message_to_json_bytes_serializer.py,sha256=RGZJ64t4t4Pz2FCASZZCv-
|
|
|
230
230
|
buz/wrapper/__init__.py,sha256=GnRdJFcncn-qp0hzDG9dBHLmTJSbHFVjE_yr-MdW_n4,77
|
|
231
231
|
buz/wrapper/async_to_sync.py,sha256=OfK-vrVUhuN-LLLvekLdMbQYtH0ue5lfbvuasj6ovMI,698
|
|
232
232
|
buz/wrapper/event_loop.py,sha256=pfBJ1g-8A2a3YgW8Gf9Fg0kkewoh3-wgTy2KIFDyfHk,266
|
|
233
|
-
buz-2.13.
|
|
234
|
-
buz-2.13.
|
|
235
|
-
buz-2.13.
|
|
236
|
-
buz-2.13.
|
|
233
|
+
buz-2.13.1rc4.dist-info/LICENSE,sha256=Jytu2S-2SPEgsB0y6BF-_LUxIWY7402fl0JSh36TLZE,1062
|
|
234
|
+
buz-2.13.1rc4.dist-info/METADATA,sha256=tv1O0K_gaN6QII_FQFL_7OAuBCPsSkkoMiKEyc2ljdo,1620
|
|
235
|
+
buz-2.13.1rc4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
236
|
+
buz-2.13.1rc4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|