/// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public ServiceBus(ServiceBusConfiguration configuration)
        {
            if (configuration.ServiceLocator == null)
            {
                throw new ArgumentException("Service Locator doesn't registered. Use SetServiceLocator() method.");
            }

            if (configuration.InputQueue == null)
            {
                throw new ArgumentException("Input queue not configured. Use SetInputQueue() method.");
            }

            _configuration = configuration;
            _provider      = configuration.Transport;
            _inputTransportEndpointAddress = configuration.InputQueue;
            _errorTransportEndpointAddress = configuration.ErrorQueue;
            _endpointMapping = configuration.EndpointsMapping;

            // use container of ServiceBus, if not specified for dispatcher
            if (_configuration.DispatcherConfiguration.ServiceLocator == null)
            {
                _configuration.DispatcherConfiguration.ServiceLocator = configuration.ServiceLocator;
            }

            TransportRegistry.Register(_inputTransportEndpointAddress, _provider);
            TransportRegistry.Register(_errorTransportEndpointAddress, _provider);
        }
        public static void Register(TransportEndpointAddress transportEndpointAddress, ITransport transport)
        {
            if (transport == null)
            {
                return;
            }

            Map[transportEndpointAddress.GetFriendlyName()] = transport;
        }
 public static ITransport GetQueueProvider(TransportEndpointAddress transportEndpointAddress)
 {
     return(!Map.TryGetValue(transportEndpointAddress.GetFriendlyName(), out ITransport provider) ? null : provider);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public SingleThreadTransportEndpointObserver(ITransport transport, TransportEndpointAddress transportEndpointAddress, String threadName = null)
 {
     Transport = transport;
     _transportEndpointAddress = transportEndpointAddress;
     _threadName = threadName;
 }