parameters:
    env(SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN): 'doctrine://default'
    env(SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN): 'doctrine://default?queue_name=main_failed'
    env(SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN): 'doctrine://default?queue_name=catalog_promotion_removal'
    env(SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN): 'doctrine://default?queue_name=catalog_promotion_removal_failed'

    sylius_messenger_transport_main_dsn: '%env(resolve:SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN)%'
    sylius_messenger_transport_main_failed_dsn: '%env(resolve:SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN)%'
    sylius_messenger_transport_catalog_promotion_removal_dsn: '%env(resolve:SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN)%'
    sylius_messenger_transport_catalog_promotion_removal_failed_dsn: '%env(resolve:SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN)%'

framework:
    messenger:
        transports:
            main:
                dsn: '%sylius_messenger_transport_main_dsn%'
                failure_transport: 'main_failed'
            main_failed:
                dsn: '%sylius_messenger_transport_main_failed_dsn%'
            catalog_promotion_removal:
                dsn: '%sylius_messenger_transport_catalog_promotion_removal_dsn%'
                failure_transport: 'catalog_promotion_removal_failed'
            catalog_promotion_removal_failed:
                dsn: '%sylius_messenger_transport_catalog_promotion_removal_failed_dsn%'
        reset_on_message: true
        routing:
            'Sylius\Bundle\CoreBundle\CatalogPromotion\Command\ApplyCatalogPromotionsOnVariants': main
            'Sylius\Bundle\CoreBundle\CatalogPromotion\Command\DisableCatalogPromotion': main
            'Sylius\Bundle\CoreBundle\CatalogPromotion\Command\RemoveCatalogPromotion': catalog_promotion_removal
            'Sylius\Bundle\CoreBundle\CatalogPromotion\Command\RemoveInactiveCatalogPromotion': catalog_promotion_removal
            'Sylius\Bundle\CoreBundle\PriceHistory\Command\ApplyLowestPriceOnChannelPricings': main
            'Sylius\Component\Promotion\Event\CatalogPromotionCreated': main
            'Sylius\Component\Promotion\Event\CatalogPromotionEnded': main
            'Sylius\Component\Promotion\Event\CatalogPromotionUpdated': main
        default_bus: sylius.command_bus
        buses:
            sylius.command_bus: &command_bus
                middleware:
                    - 'validation'
                    - 'doctrine_transaction'
            sylius.query_bus:
                middleware:
                    - validation
            sylius.event_bus: &event_bus
                default_middleware: allow_no_handlers
            sylius_default.bus: *command_bus
            sylius_event.bus: *event_bus
