/// <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);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public ServiceBusConfiguration()
        {
            EndpointsMapping        = new EndpointsMapping();
            DispatcherConfiguration = new DispatcherConfiguration();

            // Default name of service bus
            Name = "Unnamed";

            // By default we are using one thread
            NumberOfWorkerThreads = 1;
        }