[add]: threading for Kafa integration
This commit is contained in:
@@ -11,7 +11,8 @@ class KafkaIntegration:
|
||||
'bootstrap.servers': settings.KAFKA_BROKER,
|
||||
'client.id': 'loan-service-producer',
|
||||
'acks': 'all',
|
||||
'retries': 3
|
||||
'retries': 3,
|
||||
'debug': 'broker,topic,msg'
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +32,6 @@ class KafkaIntegration:
|
||||
"""Called once for each message produced"""
|
||||
if err is not None:
|
||||
logger.error(f'Message delivery failed: {err}')
|
||||
|
||||
raise RuntimeError(f"Message delivery failed: {err}")
|
||||
|
||||
else:
|
||||
@@ -62,7 +62,9 @@ class KafkaIntegration:
|
||||
value=json.dumps(loan_data).encode('utf-8'),
|
||||
callback=KafkaIntegration.delivery_report
|
||||
)
|
||||
|
||||
producer.poll(0)
|
||||
|
||||
logger.info(f"Loan request {request_id} queued for processing")
|
||||
|
||||
except Exception as e:
|
||||
|
||||
@@ -37,9 +37,9 @@ class SimbrellaIntegration:
|
||||
response = requests.post(url, json=payload, timeout=10)
|
||||
|
||||
# Raise an error for non-200 responses
|
||||
# response.raise_for_status()
|
||||
response.raise_for_status()
|
||||
|
||||
return response.json()
|
||||
except requests.exceptions.RequestException as err:
|
||||
logger.error(f"RACCheck API call failed: {str(err)}", exc_info=True)
|
||||
return {"error": "RACCheck API error", "details": str(err)}
|
||||
return {"error": "RACCheck API error"}
|
||||
|
||||
Reference in New Issue
Block a user