progress on kafka
This commit is contained in:
@@ -1,7 +1,38 @@
|
||||
from app import create_app
|
||||
from app.integrations import KafkaIntegration
|
||||
from app.config import settings
|
||||
import logging
|
||||
|
||||
app = create_app()
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if __name__ != "__main__":
|
||||
|
||||
kafka = KafkaIntegration()
|
||||
|
||||
while True:
|
||||
message = kafka.receive_disbursement_messages(
|
||||
topic=settings.KAFKA_PAYMENT_TOPIC, timeout=1.0
|
||||
)
|
||||
|
||||
if message:
|
||||
logger.info(f"Processed message: {message}")
|
||||
else:
|
||||
logger.info("No message received within timeout")
|
||||
|
||||
# try:
|
||||
# message = kafka.receive_disbursement_messages(
|
||||
# topic=settings.KAFKA_PAYMENT_TOPIC, timeout=5.0
|
||||
# )
|
||||
|
||||
# if message:
|
||||
# logger.info(f"Processed message: {message}")
|
||||
# else:
|
||||
# logger.info("No message received within timeout")
|
||||
# except Exception as e:
|
||||
# print(f"Error: {e}")
|
||||
# finally:
|
||||
# kafka.close_consumer()
|
||||
|
||||
# Expose WSGI app instance for Gunicorn
|
||||
wsgi_app = app
|
||||
wsgi_app = app
|
||||
|
||||
Reference in New Issue
Block a user