SIENTIAPDE-988

Enhance README and Docker setup; improve IngestorManager and DataManager functionality, add error handling, and implement unit tests for OPC initialization and subscription management.
This commit is contained in:
vitor-aignosi
2025-04-17 17:13:13 -03:00
parent 4e919a08be
commit fa51d142e8
13 changed files with 546 additions and 80 deletions

View File

@@ -43,9 +43,16 @@ class DataManager():
Exception: If there is an error during message delivery, it will be handled by the `delivery_error` callback.
"""
self.kafka_producer.send(
topic=topic, value=data).add_callback(
self.delivery_report).add_errback(
self.delivery_error)
try:
self.kafka_producer.flush()
self.logger.info(
f"Publishing message to topic {topic}: {data}")
self.kafka_producer.send(
topic=topic, value=data).add_callback(
self.delivery_report).add_errback(
self.delivery_error)
self.kafka_producer.flush(timeout=10)
except Exception as e:
self.logger.error(f"Failed to publish message: {e}")