Fix auth module

This commit is contained in:
Urtzi Alfaro
2025-07-17 21:48:41 +02:00
parent efca9a125a
commit 7f9dfcc088
6 changed files with 185 additions and 20 deletions

View File

@@ -1,9 +1,25 @@
# app/services/messaging.py
"""
Messaging service for auth service
"""
from shared.messaging.rabbitmq import RabbitMQClient
from app.core.config import settings
import logging
logger = logging.getLogger(__name__)
# Global message publisher
message_publisher = RabbitMQClient(settings.RABBITMQ_URL)
message_publisher = RabbitMQClient(settings.RABBITMQ_URL)
async def setup_messaging():
"""Establishes connection to RabbitMQ for the message publisher."""
logger.info("Attempting to connect to RabbitMQ...")
await message_publisher.connect()
logger.info("RabbitMQ connection established.")
async def cleanup_messaging():
"""Closes the connection to RabbitMQ for the message publisher."""
logger.info("Attempting to disconnect from RabbitMQ...")
await message_publisher.disconnect()
logger.info("RabbitMQ connection closed.")