fie fixced
This commit is contained in:
+1
-1
@@ -24,5 +24,5 @@ BANK_CALL_DISBURSE_LOAN_ENDPOINT="/api/DisburseLoan"
|
||||
BANK_CALL_COLLECT_LOAN_ENDPOINT="/api/CollectLoan"
|
||||
BANK_CALL_TRANSACTION_VERIFY="/api/TransactionVerify"
|
||||
|
||||
FLASK_APP=wsgi.py
|
||||
FLASK_APP=event_wsgi.py
|
||||
FLASK_ENV=development
|
||||
@@ -11,8 +11,8 @@ services:
|
||||
- FLASK_APP=wsgi.py
|
||||
- FLASK_ENV=production
|
||||
#- SQLALCHEMY_DATABASE_URI_FULL="oracle+oracledb://FIRSTADVSTG:Pchanged_56789@10.2.110.30:1521/?service_name=firstadv"
|
||||
volumes:
|
||||
- .:/app
|
||||
# volumes:
|
||||
# - .:/app
|
||||
#network_mode: "host" # Uses the host's network
|
||||
restart: always
|
||||
networks:
|
||||
@@ -26,10 +26,10 @@ services:
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
- FLASK_APP=app.py
|
||||
# - FLASK_APP=event_app.py
|
||||
- FLASK_RUN_HOST=0.0.0.0
|
||||
volumes:
|
||||
- .:/app
|
||||
# volumes:
|
||||
# - .:/app
|
||||
restart: always
|
||||
networks:
|
||||
- digifi-net
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import threading
|
||||
from app import create_app
|
||||
from app.integrations import KafkaIntegration
|
||||
from app.config import settings
|
||||
from app.utils.logger import logger
|
||||
|
||||
app = create_app()
|
||||
kafka = KafkaIntegration()
|
||||
|
||||
def start_kafka_consumer(app):
|
||||
with app.app_context():
|
||||
logger.info("Starting Kafka consumer...")
|
||||
while True:
|
||||
try:
|
||||
|
||||
message = kafka.receive_messages(
|
||||
topics=settings.KAFKA_TOPICS, timeout=settings.KAFKA_TIMEOUT
|
||||
)
|
||||
|
||||
if message:
|
||||
logger.info(f"Processed message: {message}")
|
||||
else:
|
||||
logger.info("No message received within timeout")
|
||||
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error while receiving message: {e}")
|
||||
|
||||
|
||||
|
||||
if __name__ != "__main__":
|
||||
|
||||
# Expose WSGI app instance for Gunicorn
|
||||
wsgi_app = app
|
||||
|
||||
# Start kafka in a thread
|
||||
threading.Thread(target=start_kafka_consumer, args=(app,), daemon=True).start()
|
||||
+1
-31
@@ -1,37 +1,7 @@
|
||||
import threading
|
||||
from app import create_app
|
||||
from app.integrations import KafkaIntegration
|
||||
from app.config import settings
|
||||
from app.utils.logger import logger
|
||||
|
||||
app = create_app()
|
||||
kafka = KafkaIntegration()
|
||||
|
||||
def start_kafka_consumer(app):
|
||||
with app.app_context():
|
||||
logger.info("Starting Kafka consumer...")
|
||||
while True:
|
||||
try:
|
||||
|
||||
message = kafka.receive_messages(
|
||||
topics=settings.KAFKA_TOPICS, timeout=settings.KAFKA_TIMEOUT
|
||||
)
|
||||
|
||||
if message:
|
||||
logger.info(f"Processed message: {message}")
|
||||
else:
|
||||
logger.info("No message received within timeout")
|
||||
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error while receiving message: {e}")
|
||||
|
||||
|
||||
|
||||
if __name__ != "__main__":
|
||||
|
||||
# Expose WSGI app instance for Gunicorn
|
||||
wsgi_app = app
|
||||
|
||||
# Start kafka in a thread
|
||||
threading.Thread(target=start_kafka_consumer, args=(app,), daemon=True).start()
|
||||
wsgi_app = app
|
||||
|
||||
Reference in New Issue
Block a user