Example #1
0
        public void Setup()
        {
            if (EndpointFactoryConfigurator != null)
            {
                ConfigurationResult result = ConfigurationResultImpl.CompileResults(EndpointFactoryConfigurator.Validate());

                try
                {
                    EndpointFactory             = EndpointFactoryConfigurator.CreateEndpointFactory();
                    EndpointFactoryConfigurator = null;

                    _endpointCache = new EndpointCache(EndpointFactory);
                    EndpointCache  = new EndpointCacheProxy(_endpointCache);
                }
                catch (Exception ex)
                {
                    throw new ConfigurationException(result, "An exception was thrown during endpoint cache creation", ex);
                }
            }

            ServiceBusFactory.ConfigureDefaultSettings(x =>
            {
                x.SetEndpointCache(EndpointCache);
                x.SetConcurrentConsumerLimit(4);
                x.SetReceiveTimeout(150.Milliseconds());
                x.EnableAutoStart();
            });
        }
        protected IEndpointFactory BuildEndpointFactory()
        {
            ConfigurationResult result = ConfigurationResultImpl.CompileResults(_endpointFactoryConfigurator.Validate());

            IEndpointFactory endpointFactory;

            try
            {
                endpointFactory = _endpointFactoryConfigurator.CreateEndpointFactory();
            }
            catch (Exception ex)
            {
                throw new ConfigurationException(result, "An exception was thrown during endpoint cache creation", ex);
            }
            return(endpointFactory);
        }
Example #3
0
        public static EndpointCache New([NotNull] Action <IEndpointFactoryConfigurator> configure)
        {
            Guard.AgainstNull(configure, "configure");

            var configurator = new EndpointFactoryConfigurator(_defaultSettings);

            configure(configurator);

            IConfigurationResult result = ConfigurationResult.CompileResults(configurator.Validate());

            try
            {
                IEndpointFactory endpointFactory = configurator.CreateEndpointFactory();

                var endpointCache = new EndpointCache(endpointFactory);

                return(endpointCache);
            }
            catch (Exception ex)
            {
                throw new ConfigurationException(result, "An exception was thrown during endpoint cache creation", ex);
            }
        }
Example #4
0
 public IEndpointFactory CreateEndpointFactory()
 {
     return(_endpointFactoryConfigurator.CreateEndpointFactory());
 }