framework:
    messenger:
        failure_transport: failed

        transports:
            # https://symfony.com/doc/current/messenger.html#transport-configuration
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    use_notify: true
                    check_delayed_interval: 60000
                retry_strategy:
                    max_retries: 3
                    multiplier: 2
            failed: 'doctrine://default?queue_name=failed'
            sync: 'sync://'

        default_bus: messenger.bus.default

        buses:
            messenger.bus.default:
                middleware:
                    # Ce middleware doit \u00eatre plac\u00e9 en premier pour g\u00e9rer le routing dynamique
                    - App\Messenger\Middleware\DynamicTransportMiddleware
                    # Ce middleware g\u00e8re les erreurs en mode synchrone
                    - App\Messenger\Middleware\SyncErrorHandlerMiddleware

        routing:
            # Le routing est g\u00e9r\u00e9 dynamiquement par DynamicTransportMiddleware
            # en fonction de la variable MESSENGER_MODE
            Symfony\Component\Mailer\Messenger\SendEmailMessage: async
            Symfony\Component\Notifier\Message\ChatMessage: async
            Symfony\Component\Notifier\Message\SmsMessage: async

            # Application Messages
            App\Message\SendEmailMessage: async
            App\Message\LogHttpRequestMessage: async
            App\Message\BlockIpMessage: async
            App\Message\SendSecurityNotificationMessage: async
