New alert service
This commit is contained in:
@@ -7,8 +7,8 @@ from sqlalchemy import text
|
||||
from app.core.config import settings
|
||||
from app.core.database import database_manager
|
||||
from app.api import auth_operations, users, onboarding_progress, consent, data_export, account_deletion
|
||||
from app.services.messaging import setup_messaging, cleanup_messaging
|
||||
from shared.service_base import StandardFastAPIService
|
||||
from shared.messaging import UnifiedEventPublisher
|
||||
|
||||
|
||||
class AuthService(StandardFastAPIService):
|
||||
@@ -114,12 +114,25 @@ class AuthService(StandardFastAPIService):
|
||||
|
||||
async def _setup_messaging(self):
|
||||
"""Setup messaging for auth service"""
|
||||
await setup_messaging()
|
||||
self.logger.info("Messaging setup complete")
|
||||
from shared.messaging import RabbitMQClient
|
||||
try:
|
||||
self.rabbitmq_client = RabbitMQClient(settings.RABBITMQ_URL, service_name="auth-service")
|
||||
await self.rabbitmq_client.connect()
|
||||
# Create event publisher
|
||||
self.event_publisher = UnifiedEventPublisher(self.rabbitmq_client, "auth-service")
|
||||
self.logger.info("Auth service messaging setup completed")
|
||||
except Exception as e:
|
||||
self.logger.error("Failed to setup auth messaging", error=str(e))
|
||||
raise
|
||||
|
||||
async def _cleanup_messaging(self):
|
||||
"""Cleanup messaging for auth service"""
|
||||
await cleanup_messaging()
|
||||
try:
|
||||
if self.rabbitmq_client:
|
||||
await self.rabbitmq_client.disconnect()
|
||||
self.logger.info("Auth service messaging cleanup completed")
|
||||
except Exception as e:
|
||||
self.logger.error("Error during auth messaging cleanup", error=str(e))
|
||||
|
||||
async def on_shutdown(self, app: FastAPI):
|
||||
"""Custom shutdown logic for auth service"""
|
||||
|
||||
Reference in New Issue
Block a user