Fix auth module
This commit is contained in:
@@ -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.")
|
||||
Reference in New Issue
Block a user