<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © 2016 Filoblu S.r.l. All rights reserved.
 */
 -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <preference for="FiloBlu\Esb\Api\Data\AcknowledgeInterface" type="FiloBlu\Esb\Model\Acknowledge"/>
    <preference for="FiloBlu\Esb\Api\Data\PublisherInterface" type="FiloBlu\Esb\Model\PublisherResolver"/>
    <preference for="FiloBlu\Esb\Api\Data\QueueItemInterface" type="FiloBlu\Esb\Model\QueueItem"/>
    <preference for="FiloBlu\Esb\Api\Data\MessageInterface" type="FiloBlu\Esb\Model\Message"/>
    <preference for="FiloBlu\Esb\Api\Data\StatusInterface" type="FiloBlu\Esb\Model\Status"/>
    <preference for="FiloBlu\Esb\Api\Data\ConsumerConfigurationInterface" type="FiloBlu\Esb\Model\ConsumerConfiguration"/>
    <preference for="FiloBlu\Esb\Api\Data\ProducerConfigurationInterface" type="FiloBlu\Esb\Model\ProducerConfiguration"/>
    <preference for="FiloBlu\Esb\Core\Expression\ExpressionInterface" type="FiloBlu\Esb\Core\Expression\Expression"/>
    <preference for="FiloBlu\Esb\Api\Data\ObjectTypeInterface" type="FiloBlu\Esb\Model\ObjectType\ObjectType"/>
    <preference for="FiloBlu\Esb\Api\Data\EventConfigurationInterface" type="FiloBlu\Esb\Model\EventConfiguration"/>
    <preference for="FiloBlu\Esb\Api\ExternalInvoiceInterface" type="FiloBlu\Esb\Model\Rest\ExternalInvoice"/>
    <preference for="FiloBlu\Esb\Api\ExternalShipmentInterface" type="FiloBlu\Esb\Model\Rest\ExternalShipment"/>
    <preference for="FiloBlu\Esb\Api\ExternalCreditmemoInterface" type="FiloBlu\Esb\Model\Rest\ExternalCreditmemo"/>
    <preference for="FiloBlu\Esb\Api\ExternalCreditmemoV2Interface" type="FiloBlu\Esb\Model\Rest\ExternalCreditmemoV2"/>
    <preference for="FiloBlu\Esb\Api\AcknowledgeManagementInterface" type="FiloBlu\Esb\Model\Rest\AcknowledgeManagement"/>
    <preference for="FiloBlu\Esb\Api\QueueItemRepositoryInterface" type="FiloBlu\Esb\Model\QueueItemRepository"/>
    <preference for="FiloBlu\Esb\Api\ConsumerResolverInterface" type="FiloBlu\Esb\Model\ConsumerResolver"/>
    <preference for="FiloBlu\Esb\Api\DispatcherInterface" type="FiloBlu\Esb\Model\Dispatcher"/>
    <preference for="FiloBlu\Esb\Api\RetryStrategyInterface" type="FiloBlu\Esb\Model\NoRetryStrategy"/>
    <preference for="FiloBlu\Esb\Api\PublisherResolverInterface" type="FiloBlu\Esb\Model\PublisherResolver"/>
    <preference for="FiloBlu\Esb\Api\ProducerResolverInterface" type="FiloBlu\Esb\Model\ProducerResolver"/>
    <preference for="FiloBlu\Esb\Api\ConsumerConfigurationRepositoryInterface" type="FiloBlu\Esb\Model\ConsumerConfigurationRepository"/>
    <preference for="FiloBlu\Esb\Api\ProducerConfigurationRepositoryInterface" type="FiloBlu\Esb\Model\ProducerConfigurationRepository"/>
    <preference for="FiloBlu\Esb\Core\Expression\EvaluatorInterface" type="FiloBlu\Esb\Core\Expression\BooleanEvaluator"/>
    <preference for="FiloBlu\Esb\Api\ObjectTypeDescriptorResolverInterface" type="FiloBlu\Esb\Model\ObjectTypeDescriptorResolver"/>
    <preference for="FiloBlu\Esb\Api\RetryStrategyResolverInterface" type="FiloBlu\Esb\Model\RetryStrategyResolver"/>
    <preference for="FiloBlu\Esb\Core\Id\UUID4GeneratorInterface" type="FiloBlu\Esb\Core\Id\UUID4Generator"/>
    <preference for="FiloBlu\Esb\Api\EventResolverInterface" type="FiloBlu\Esb\Model\EventResolver"/>
    <preference for="FiloBlu\Esb\Api\EventConfigurationRepositoryInterface" type="FiloBlu\Esb\Model\EventConfigurationRepository"/>
    <preference for="FiloBlu\Esb\Api\Data\QueueMetadataInterface" type="FiloBlu\Esb\Model\QueueMetadata"/>
    <preference for="FiloBlu\Esb\Converter\ConverterResolverInterface" type="FiloBlu\Esb\Converter\DataObjectConverterResolver"/>
    <preference for="FiloBlu\Esb\Framework\Template\TemplateInterface" type="FiloBlu\Esb\Framework\Template\SimpleTemplate"/>
    <preference for="FiloBlu\Esb\Model\ObjectTypeSaverResolverInterface" type="FiloBlu\Esb\Model\ObjectTypeSaverResolver"/>
    <preference for="FiloBlu\Esb\Model\ObjectTypeLoaderResolverInterface" type="FiloBlu\Esb\Model\ObjectTypeLoaderResolver"/>
    <preference for="FiloBlu\Esb\Core\Expression\VariableExpanderInterface" type="FiloBlu\Esb\Core\Expression\VariableExpander"/>
    <preference for="FiloBlu\Esb\Api\ExternalOrderInterface" type="FiloBlu\Esb\Model\Rest\ExternalOrder"/>
    <!-- 1] Define which kind of object type are defined in the system with loaders and savers-->

    <!-- 1.1] Define the object type (descriptors) available on the system -->
    <type name="FiloBlu\Esb\Model\ObjectTypeDescriptorResolver">
        <arguments>
            <argument name="objectTypes" xsi:type="array">
                <item name="any" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Any</item>
                <item name="none" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\None</item>
                <item name="order" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</item>
                <item name="shipment" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Shipment</item>
                <item name="customer" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Customer</item>
                <item name="customer_address" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\CustomerAddress</item>
                <item name="creditmemo" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Creditmemo</item>
                <item name="form" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Form</item>
                <item name="product" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Product</item>
                <item name="quote" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Quote</item>
                <item name="invoice" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Invoice</item>
                <item name="subscriber" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Subscriber</item>
            </argument>
        </arguments>
    </type>

    <!-- 1.2] Define OrderSaveAfterProducer(s) and Saver(s) to load an save object passed through Consumer(s) and Producer(s) -->

    <type name="FiloBlu\Esb\Model\Loader\NullLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Any</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Saver\NullSaver">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\None</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Loader\CustomerLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Customer</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Loader\CustomerAddressLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\CustomerAddress</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Saver\CustomerSaver">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Customer</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Saver\CustomerAddressSaver">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\CustomerAddress</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Loader\ShipmentLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Shipment</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Saver\ShipmentSaver">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Shipment</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Loader\OrderLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Loader\OrderSaveLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Loader\CreditmemoLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Creditmemo</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Loader\ProductLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Product</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Loader\QuoteLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Quote</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Saver\OrderSaver">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Saver\CreditmemoSaver">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Creditmemo</argument>
        </arguments>
    </type>

    <virtualType name="FiloBlu\Esb\Model\Loader\OrderPlacedLoader" type="FiloBlu\Esb\Model\Loader\OrderLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\OrderPlaced</argument>
        </arguments>
    </virtualType>

    <type name="FiloBlu\Esb\Model\Loader\InvoiceLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Invoice</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Loader\SubscriberLoader">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Subscriber</argument>
        </arguments>
    </type>

    <!-- 1.3] Register them on the system -->

    <type name="FiloBlu\Esb\Model\ObjectTypeSaverResolver">
        <arguments>
            <argument name="savers" xsi:type="array">
                <item name="FiloBlu_Esb::null_saver" xsi:type="object">FiloBlu\Esb\Model\Saver\NullSaver</item>
                <item name="FiloBlu_Esb::order_saver" xsi:type="object">FiloBlu\Esb\Model\Saver\OrderSaver</item>
                <item name="FiloBlu_Esb::creditmemo_saver" xsi:type="object">FiloBlu\Esb\Model\Saver\CreditmemoSaver</item>
                <item name="FiloBlu_Esb::customer_saver" xsi:type="object">FiloBlu\Esb\Model\Saver\CustomerSaver</item>
                <item name="FiloBlu_Esb::customer_address_saver" xsi:type="object">FiloBlu\Esb\Model\Saver\CustomerAddressSaver</item>
                <item name="FiloBlu_Esb::shipment_saver" xsi:type="object">FiloBlu\Esb\Model\Saver\ShipmentSaver</item>
            </argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\ObjectTypeLoaderResolver">
        <arguments>
            <argument name="loaders" xsi:type="array">
                <item name="FiloBlu_Esb::null_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\NullLoader</item>
                <item name="FiloBlu_Esb::order_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\OrderLoader</item>
                <item name="FiloBlu_Esb::creditmemo_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\CreditmemoLoader</item>
                <item name="FiloBlu_Esb::order_enriched_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\OrderEnrichedLoader</item>
                <item name="FiloBlu_Esb::order_placed_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\OrderPlacedLoader</item>
                <item name="FiloBlu_Esb::shipment_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\ShipmentLoader</item>
                <item name="FiloBlu_Esb::customer_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\CustomerLoader</item>
                <item name="FiloBlu_Esb::customer_address_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\CustomerAddressLoader</item>
                <item name="FiloBlu_Esb::product_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\ProductLoader</item>
                <item name="FiloBlu_Esb::quote_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\QuoteLoader</item>
                <item name="FiloBlu_Esb::order_save_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\OrderSaveLoader</item>
                <item name="FiloBlu_Esb::invoice_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\InvoiceLoader</item>
                <item name="FiloBlu_Esb::subscriber_loader" xsi:type="object">FiloBlu\Esb\Model\Loader\SubscriberLoader</item>
            </argument>
        </arguments>
    </type>

    <!-- 2] Define base event -->

    <virtualType name="FiloBlu\Esb\Model\Event\OrderPlacedEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Order Placed Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::order_placed_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\OrderCompleteEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Order Complete Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::order_complete_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\ShipmentEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Shipment Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::order_shipped_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Shipment</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\CustomerRegisterEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Customer Register Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::customer_register_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Customer</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\CustomerSaveAfterEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Customer Save After Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::customer_save_after_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Customer</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\CustomerAddressSaveAfterEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Customer Address Save After Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::customer_address_save_after_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\CustomerAddress</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\CreditmemoPlacedEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Creditmemo Placed Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::creditmemo_placed_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Creditmemo</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\FormEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Form Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::form_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Form</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\ProductEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Product Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::product_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Product</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\QuoteEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Quote Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::quote_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Quote</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\OrderSavedEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Order Saved Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::order_saved_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\CustomerSavedEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Customer Saved Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::customer_saved_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Customer</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\InvoiceSavedEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Invoice Saved Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::invoice_saved_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Invoice</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Model\Event\SubscriberSavedEvent" type="FiloBlu\Esb\Model\Event\Event">
        <arguments>
            <argument name="name" xsi:type="string">Subscriber Saved Event</argument>
            <argument name="uniqueName" xsi:type="string">FiloBlu_Esb::subscriber_saved_event</argument>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Subscriber</argument>
        </arguments>
    </virtualType>

    <!-- 3] Then register them as template -->

    <type name="FiloBlu\Esb\Model\EventResolver">
        <arguments>
            <argument name="events" xsi:type="array">
                <item name="FiloBlu_Esb::order_placed_event" xsi:type="object">FiloBlu\Esb\Model\Event\OrderPlacedEvent</item>
                <item name="FiloBlu_Esb::creditmemo_placed_event" xsi:type="object">FiloBlu\Esb\Model\Event\CreditmemoPlacedEvent</item>
                <item name="FiloBlu_Esb::order_complete_event" xsi:type="object">FiloBlu\Esb\Model\Event\OrderCompleteEvent</item>
                <item name="FiloBlu_Esb::form_event" xsi:type="object">FiloBlu\Esb\Model\Event\FormEvent</item>
                <item name="FiloBlu_Esb::customer_save_after_event" xsi:type="object">FiloBlu\Esb\Model\Event\CustomerSaveAfterEvent</item>
                <item name="FiloBlu_Esb::customer_address_save_after_event" xsi:type="object">FiloBlu\Esb\Model\Event\CustomerAddressSaveAfterEvent</item>
                <item name="FiloBlu_Esb::order_shipped_event" xsi:type="object">FiloBlu\Esb\Model\Event\ShipmentEvent</item>
                <item name="FiloBlu_Esb::product_event" xsi:type="object">FiloBlu\Esb\Model\Event\ProductEvent</item>
                <item name="FiloBlu_Esb::quote_event" xsi:type="object">FiloBlu\Esb\Model\Event\QuoteEvent</item>
                <item name="FiloBlu_Esb::order_saved_event" xsi:type="object">FiloBlu\Esb\Model\Event\OrderSavedEvent</item>
                <item name="FiloBlu_Esb::customer_saved_event" xsi:type="object">FiloBlu\Esb\Model\Event\CustomerSavedEvent</item>
                <item name="FiloBlu_Esb::invoice_saved_event" xsi:type="object">FiloBlu\Esb\Model\Event\InvoiceSavedEvent</item>
                <item name="FiloBlu_Esb::subscriber_saved_event" xsi:type="object">FiloBlu\Esb\Model\Event\SubscriberSavedEvent</item>
            </argument>
        </arguments>
    </type>

    <!-- 4] Then register producer and consumers  -->

    <!-- 4.1] Producers -->
    <type name="FiloBlu\Esb\Model\Producer\OrderSaveAfterProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\CreditmemoSaveAfterProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Creditmemo</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\CustomerSaveAfterProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Customer</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\CustomerAddressSaveAfterProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\CustomerAddress</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\FormProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Form</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\ShipmentProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Shipment</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\ProductSaveAfterProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Product</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\QuoteSaveAfterProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Quote</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\CustomerHubspotSaveAfterProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Customer</argument>
        </arguments>
    </type>

    <!-- 4.2] Consumers -->
    <type name="FiloBlu\Esb\Model\Consumer\SendCustomerToEndpointConsumer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Customer</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Consumer\SendOrderToEndpointConsumer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Consumer\SendOrderItemToEndpointConsumer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Consumer\SendShipmentToEndpointConsumer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Shipment</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Consumer\AnyConsumer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Any</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Consumer\VoidConsumer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\None</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\StockStatusSaveAfterProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Product</argument>
        </arguments>
    </type>

    <!-- 5] Say hello to the system -->
    <type name="FiloBlu\Esb\Model\ProducerResolver">
        <arguments>
            <argument name="producers" xsi:type="array">
                <item name="FiloBlu_Esb::order_save_after" xsi:type="object">FiloBlu\Esb\Model\Producer\OrderSaveAfterProducer</item>
                <item name="FiloBlu_Esb::creditmemo_save_after" xsi:type="object">FiloBlu\Esb\Model\Producer\CreditmemoSaveAfterProducer</item>
                <item name="FiloBlu_Esb::form_submit" xsi:type="object">FiloBlu\Esb\Model\Producer\FormProducer</item>
                <item name="FiloBlu_Esb::customer_save_after" xsi:type="object">FiloBlu\Esb\Model\Producer\CustomerSaveAfterProducer</item>
                <item name="FiloBlu_Esb::customer_address_save_after" xsi:type="object">FiloBlu\Esb\Model\Producer\CustomerAddressSaveAfterProducer</item>
                <item name="FiloBlu_Esb::shipment_save" xsi:type="object">FiloBlu\Esb\Model\Producer\ShipmentProducer</item>
                <item name="FiloBlu_Esb::product_save_after" xsi:type="object">FiloBlu\Esb\Model\Producer\ProductSaveAfterProducer</item>
                <item name="FiloBlu_Esb::quote_save_after" xsi:type="object">FiloBlu\Esb\Model\Producer\QuoteSaveAfterProducer</item>
                <item name="FiloBlu_Esb::customer_hubspot_save_after" xsi:type="object">FiloBlu\Esb\Model\Producer\CustomerHubspotSaveAfterProducer</item>
                <item name="FiloBlu_Esb::stock_status_save_after" xsi:type="object">FiloBlu\Esb\Model\Producer\StockStatusSaveAfterProducer</item>
                <item name="FiloBlu_Esb::invoice_save_after" xsi:type="object">FiloBlu\Esb\Model\Producer\InvoiceSaveAfterProducer</item>
                <item name="FiloBlu_Esb::subscriber_save_after" xsi:type="object">FiloBlu\Esb\Model\Producer\SubscriberSaveAfterProducer</item>
            </argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\ConsumerResolver">
        <arguments>
            <argument name="consumers" xsi:type="array">
                <item name="FiloBlu_Esb::any" xsi:type="object">FiloBlu\Esb\Model\Consumer\AnyConsumer</item>
                <item name="FiloBlu_Esb::void" xsi:type="object">FiloBlu\Esb\Model\Consumer\VoidConsumer</item>
                <item name="FiloBlu_ESB::send_customer_to_endpoint" xsi:type="object">FiloBlu\Esb\Model\Consumer\SendCustomerToEndpointConsumer</item>
                <item name="FiloBlu_Esb::send_order_to_endpoint" xsi:type="object">FiloBlu\Esb\Model\Consumer\SendOrderToEndpointConsumer</item>
                <item name="FiloBlu_Esb::send_order_item_to_endpoint" xsi:type="object">FiloBlu\Esb\Model\Consumer\SendOrderItemToEndpointConsumer</item>
                <item name="FiloBlu_Esb::send_shipment_to_endpoint" xsi:type="object">FiloBlu\Esb\Model\Consumer\SendShipmentToEndpointConsumer</item>
            </argument>
        </arguments>
    </type>

    <!-- 6] Configure Emitters activators -->

    <type name="FiloBlu\Esb\Observer\SalesOrderSaveAfter">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\OrderPlacedEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Plugin\OrderPlace\Plugin">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\OrderPlacedEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\SalesOrderInvoiceRegister">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\OrderPlacedEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\SalesOrderShipmentSaveAfter">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\ShipmentEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\CustomerRegisterSuccess">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\CustomerRegisterEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Plugin\Magento\Sales\Api\CreditmemoRepositoryInterface">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\CreditmemoPlacedEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\CustomerSaveAfter">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\CustomerSaveAfterEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\CustomerAddressSaveAfter">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\CustomerAddressSaveAfterEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\ProductSaveObserver">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\ProductEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\QuoteSaveObserver">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\QuoteEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\OrderSaveObserver">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\OrderSavedEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\CustomerSaveObserver">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\CustomerSavedEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\InvoiceSaveAfterObserver">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\InvoiceSavedEvent</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Observer\SubscriberSaveAfterObserver">
        <arguments>
            <argument name="eventToEmit" xsi:type="object">FiloBlu\Esb\Model\Event\SubscriberSavedEvent</argument>
        </arguments>
    </type>

    <type name="Magento\Sales\Api\OrderManagementInterface">
        <plugin name="order_place" type="FiloBlu\Esb\Plugin\OrderPlace\Plugin" sortOrder="999" disabled="false"/>
    </type>

    <type name="Magento\Sales\Api\CreditmemoRepositoryInterface">
        <plugin name="FiloBlu_Esb_Plugin_Magento_Sales_Api_CreditmemoRepositoryInterface" type="\FiloBlu\Esb\Plugin\Magento\Sales\Api\CreditmemoRepositoryInterface" sortOrder="999" disabled="false"/>
    </type>

    <type name="Magento\Sales\Model\ResourceModel\Order\Handler\State">
        <plugin name="FiloBlu_Esb_Plugin_Magento_Sales_Model_ResourceModel_Order_Handler_State" type="\FiloBlu\Esb\Plugin\Magento\Sales\Model\ResourceModel\Order\Handler\StatePlugin" sortOrder="999" disabled="false"/>
    </type>

    <!-- 7] Register converters -->

    <virtualType name="FiloBlu\Esb\Converter\OrderInterfaceToDataObjectConverter" type="FiloBlu\Esb\Converter\ObjectToDataObjectConverter">
        <arguments>
            <argument name="type" xsi:type="string">Magento\Sales\Api\Data\OrderInterface</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Converter\ShipmentInterfaceToDataObjectConverter" type="FiloBlu\Esb\Converter\ObjectToDataObjectConverter">
        <arguments>
            <argument name="type" xsi:type="string">Magento\Sales\Api\Data\ShipmentInterface</argument>
        </arguments>
    </virtualType>

    <virtualType name="FiloBlu\Esb\Converter\CustomerInterfaceToDataObjectConverter" type="FiloBlu\Esb\Converter\ObjectToDataObjectConverter">
        <arguments>
            <argument name="type" xsi:type="string">Magento\Customer\Api\Data\CustomerInterface</argument>
        </arguments>
    </virtualType>

    <type name="FiloBlu\Esb\Converter\DataObjectConverterResolver">
        <arguments>
            <argument name="converters" xsi:type="array">
                <item name="order_to_data_object" xsi:type="object">FiloBlu\Esb\Converter\OrderInterfaceToDataObjectConverter</item>
                <item name="shipment_to_data_object" xsi:type="object">FiloBlu\Esb\Converter\ShipmentInterfaceToDataObjectConverter</item>
                <item name="customer_to_data_object" xsi:type="object">FiloBlu\Esb\Converter\CustomerInterfaceToDataObjectConverter</item>
            </argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Helper\Format\FormatFactory">
        <arguments>
            <argument name="pluginConfiguration" xsi:type="array">
                <item name="xml" xsi:type="string">FiloBlu\Esb\Helper\Format\Xml</item>
                <item name="json" xsi:type="string">FiloBlu\Esb\Helper\Format\Json</item>
            </argument>
        </arguments>
    </type>

    <type name="Magento\Framework\Console\CommandList">
        <arguments>
            <argument name="commands" xsi:type="array">
                <item name="filoblu_esb_dispatch" xsi:type="object">FiloBlu\Esb\Console\Command\Dispatch</item>
            </argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\PublisherResolver">
        <arguments>
            <argument name="publishers" xsi:type="array">
                <item name="default" xsi:type="string">FiloBlu\Esb\Model\Publisher\Db\MySql</item>
            </argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\CountToInfinityRetryStrategy">
        <arguments>
            <argument name="infinity" xsi:type="number">5</argument>
            <argument name="timeBase" xsi:type="number">5</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\AbstractOrderProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Order</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\AbstractInvoiceProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Invoice</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\Producer\AbstractSubscriberProducer">
        <arguments>
            <argument name="objectTypeDescriptor" xsi:type="object">FiloBlu\Esb\Model\ObjectType\Descriptor\Subscriber</argument>
        </arguments>
    </type>

    <type name="FiloBlu\Esb\Model\RetryStrategyResolver">
        <arguments>
            <argument name="defaultStrategy" xsi:type="object">FiloBlu\Esb\Model\NoRetryStrategy</argument>
            <argument name="strategies" xsi:type="array">
                <item name="default" xsi:type="object">FiloBlu\Esb\Model\NoRetryStrategy</item>
                <item name="count_to_infinity" xsi:type="object">FiloBlu\Esb\Model\CountToInfinityRetryStrategy</item>
            </argument>
        </arguments>
    </type>

    <preference for="FiloBlu\Esb\Api\ObjectTypeServiceInterface" type="FiloBlu\Esb\Model\Rest\ObjectTypeService"/>

    <type name="FiloBlu\Esb\Core\Expression\Expression">
        <arguments>
            <argument name="operators" xsi:type="array">
                <item name="in" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\InOperator</item>
                <item name="nin" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\NotInOperator</item>
                <item name="eq" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\EqualOperator</item>
                <item name="seq" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\StrictEqualOperator</item>
                <item name="lt" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\LessThanOperator</item>
                <item name="lte" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\LessThanEqualOperator</item>
                <item name="gt" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\GreatThanOperator</item>
                <item name="gte" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\GreatEqualThanOperator</item>
                <item name="neq" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\NotEqualOperator</item>
                <item name="startswith" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\StartsWithOperator</item>
                <item name="nstartswith" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\NotStartsWithOperator</item>
                <item name="endswith" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\EndsWithOperator</item>
                <item name="nendswith" xsi:type="object">FiloBlu\Esb\Core\Expression\Operator\NotEndsWithOperator</item>
            </argument>
        </arguments>
    </type>

</config>
