Files
Classeo/backend/config/packages/messenger.yaml
Mathias STRASSER 8c70ed1324
Some checks failed
CI / Backend Tests (push) Has been cancelled
CI / Frontend Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Naming Conventions (push) Has been cancelled
CI / Build Check (push) Has been cancelled
fix(tenant): route runtime traffic to tenant databases
Wire Doctrine's default connection to the tenant database resolved from the subdomain for HTTP requests and tenant-scoped Messenger messages while keeping master-only services on the master connection.

This removes the production inconsistency where demo data, migrations and tenant commands used the tenant database but the web runtime still read from master.
2026-03-10 23:38:26 +01:00

67 lines
3.2 KiB
YAML

framework:
messenger:
failure_transport: failed
# Three buses: Command, Query, Event (CQRS + Event-driven)
default_bus: command.bus
buses:
command.bus:
default_middleware: true
middleware:
- App\Shared\Infrastructure\Messenger\AddCorrelationIdStampMiddleware
- App\Shared\Infrastructure\Messenger\CorrelationIdMiddleware
- App\Shared\Infrastructure\Messenger\TenantDatabaseMiddleware
- doctrine_transaction
query.bus:
default_middleware: true
middleware:
- App\Shared\Infrastructure\Messenger\AddCorrelationIdStampMiddleware
- App\Shared\Infrastructure\Messenger\CorrelationIdMiddleware
- App\Shared\Infrastructure\Messenger\TenantDatabaseMiddleware
event.bus:
default_middleware:
allow_no_handlers: true
middleware:
- App\Shared\Infrastructure\Messenger\AddCorrelationIdStampMiddleware
- App\Shared\Infrastructure\Messenger\CorrelationIdMiddleware
- App\Shared\Infrastructure\Messenger\TenantDatabaseMiddleware
- App\Administration\Infrastructure\Middleware\PaginatedCacheInvalidationMiddleware
- App\Shared\Infrastructure\Messenger\MessengerMetricsMiddleware
transports:
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
options:
exchange:
name: classeo_messages
type: topic
queues:
messages:
binding_keys: ['#']
retry_strategy:
service: App\Shared\Infrastructure\Messenger\FibonacciRetryStrategy
failed:
dsn: 'doctrine://default?queue_name=failed'
routing:
# Email events → async (non-blocking API responses)
App\Administration\Domain\Event\UtilisateurInvite: async
App\Administration\Domain\Event\InvitationRenvoyee: async
App\Administration\Domain\Event\PasswordResetTokenGenerated: async
App\Administration\Domain\Event\CompteActive: async
App\Administration\Domain\Event\MotDePasseChange: async
# CompteBloqueTemporairement: sync (SendLockoutAlertHandler = immediate security alert)
# ConnexionReussie, ConnexionEchouee: sync (audit-only, no email)
# Parent invitation events → async (email sending)
App\Administration\Domain\Event\InvitationParentEnvoyee: async
App\Administration\Domain\Event\InvitationParentActivee: async
# Notification enseignants journée pédagogique → async (envoi d'emails)
App\Administration\Domain\Event\JourneePedagogiqueAjoutee: async
# Import élèves/enseignants → async (batch processing, peut être long)
App\Administration\Application\Command\ImportStudents\ImportStudentsCommand: async
App\Administration\Application\Command\ImportTeachers\ImportTeachersCommand: async