services:
    oro_message_queue.client.config:
        class: 'Oro\Component\MessageQueue\Client\Config'
        public: false

    oro_message_queue.client.driver_factory:
        class: 'Oro\Component\MessageQueue\Client\DriverFactory'
        public: false
        arguments:
            - []

    oro_message_queue.client.driver:
        class: 'Oro\Component\MessageQueue\Client\DriverInterface'
        factory: ['@oro_message_queue.client.driver_factory', 'create']
        arguments:
            - '@oro_message_queue.transport.connection'
            - '@oro_message_queue.client.config'

    oro_message_queue.client.message_producer:
        class: 'Oro\Component\MessageQueue\Client\MessageProducer'
        arguments: ['@oro_message_queue.client.driver']

    oro_message_queue.message_producer:
        alias: 'oro_message_queue.client.message_producer'

    oro_message_queue.client.router:
        class: 'Oro\Component\MessageQueue\Client\Router'
        public: false
        arguments:
            - '@oro_message_queue.client.driver'
            - '@oro_message_queue.client.meta.destination_meta_registry'
            - []

    oro_message_queue.client.route_message_processor:
        class: 'Oro\Component\MessageQueue\Router\RouteRecipientListProcessor'
        public: true
        arguments:
            - '@oro_message_queue.client.router'
        tags:
            - { name: 'oro_message_queue.client.message_processor', 'topicName': 'oro_message_queue.route_message' }

    oro_message_queue.client.message_processor_registry:
        class: 'Oro\Component\MessageQueue\Client\ContainerAwareMessageProcessorRegistry'
        public: false
        calls:
            - ['setContainer', ['@service_container']]

    oro_message_queue.client.meta.topic_meta_registry:
        class: 'Oro\Component\MessageQueue\Client\Meta\TopicMetaRegistry'
        public: true
        arguments: [[]]

    oro_message_queue.client.meta.destination_meta_registry:
        class: 'Oro\Component\MessageQueue\Client\Meta\DestinationMetaRegistry'
        public: true
        arguments: ['@oro_message_queue.client.config', [], 'default']

    oro_message_queue.client.delegate_message_processor:
        class: 'Oro\Component\MessageQueue\Client\DelegateMessageProcessor'
        public: false
        arguments:
            - '@oro_message_queue.client.message_processor_registry'

    oro_message_queue.client.extension.create_queue:
        class: 'Oro\Component\MessageQueue\Client\ConsumptionExtension\CreateQueueExtension'
        public: false
        arguments:
            - '@oro_message_queue.client.driver'
        tags:
            - { name: 'oro_message_queue.consumption.extension', priority: 10 }

    oro_message_queue.client.delay_redelivered_message_extension:
        class: 'Oro\Component\MessageQueue\Client\ConsumptionExtension\DelayRedeliveredMessageExtension'
        public: false
        arguments:
            - '@oro_message_queue.client.driver'
            - ~
        tags:
            - { name: 'oro_message_queue.consumption.extension' }

    oro_message_queue.client.queue_consumer:
        class: 'Oro\Component\MessageQueue\Consumption\QueueConsumer'
        public: false
        arguments:
            - '@oro_message_queue.transport.connection'
            - '@oro_message_queue.consumption.extensions'

    oro_message_queue.client.consume_messages_command:
        class: 'Oro\Component\MessageQueue\Client\ConsumeMessagesCommand'
        public: true
        arguments:
            - '@oro_message_queue.client.queue_consumer'
            - '@oro_message_queue.client.delegate_message_processor'
            - '@oro_message_queue.client.meta.destination_meta_registry'
        tags:
            - { name: 'console.command' }

    oro_message_queue.client.meta.topics_command:
        class: 'Oro\Component\MessageQueue\Client\Meta\TopicsCommand'
        arguments:
            - '@oro_message_queue.client.meta.topic_meta_registry'
        tags:
            - { name: 'console.command' }

    oro_message_queue.client.meta.destinations_command:
        class: 'Oro\Component\MessageQueue\Client\Meta\DestinationsCommand'
        arguments:
            - '@oro_message_queue.client.meta.destination_meta_registry'
        tags:
            - { name: 'console.command' }

    oro_message_queue.client.create_queues_command:
        class: 'Oro\Component\MessageQueue\Client\CreateQueuesCommand'
        public: true
        arguments:
            - '@oro_message_queue.client.meta.destination_meta_registry'
            - '@oro_message_queue.client.driver'
        tags:
            - { name: 'console.command' }

    oro_message_queue.profiler.message_queue_collector:
        class: 'Oro\Bundle\MessageQueueBundle\Profiler\MessageQueueCollector'
        public: false
        arguments: ['@oro_message_queue.message_producer']
        tags:
            - { name: data_collector, template: 'OroMessageQueueBundle:Collector:message_queue.html.twig', id: message_queue }
