RMQ and DB: Added reconnecting to either if the application goes down

This commit is contained in:
florian committed 2025-10-08 18:01:31 +02:00
1 parent 482a90ae7b
commit ac6ca4baf8
3 files changed
+17 -3

No files matched your search

+2 -1
View File
@@ -41,7 +41,8 @@ def create_connection():
def send_message_to_rmq(connection, user_id: int, message: Dict):
if not connection or not connection.is_open:
raise RuntimeError("RabbitMQ connection is not open")
print("[RMQ] Connection lost, reconnecting...")
connection = create_connection()
channel = connection.channel()
channel.exchange_declare(exchange=rmq_exchange, exchange_type="topic", durable=True)