Пример #1
0
        public void ActivityTextFixtureSetup()
        {
            if (_endpointFactoryConfigurator != null)
            {
                ConfigurationResult result =
                    ConfigurationResultImpl.CompileResults(_endpointFactoryConfigurator.Validate());

                try
                {
                    EndpointFactory = _endpointFactoryConfigurator.CreateEndpointFactory();

                    _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(50.Milliseconds());
                x.EnableAutoStart();
            });

            LocalUri = new Uri(BaseUri, "local");

            AddCommandContext <DispatchMessageConsumer, DispatchMessage>(() =>
            {
                var agent = new MessageDispatchAgent(LocalBus);

                return(new DispatchMessageConsumer(agent));
            });

            SetupCommands();

            LocalBus = CreateServiceBus(ConfigureLocalBus);

            DispatchEndpoint = LocalBus.GetEndpoint(GetActivityContext <DispatchMessage>().ExecuteUri);
        }
Пример #2
0
        public static IEndpointCache New([NotNull] Action <EndpointFactoryConfigurator> configure)
        {
            Guard.AgainstNull(configure, "configure");

            var configurator = new EndpointFactoryConfiguratorImpl(_defaultSettings);

            configure(configurator);

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

            try
            {
                IEndpointFactory endpointFactory = configurator.CreateEndpointFactory();

                IEndpointCache endpointCache = new EndpointCache(endpointFactory);

                return(endpointCache);
            }
            catch (Exception ex)
            {
                throw new ConfigurationException(result, "An exception was thrown during endpoint cache creation", ex);
            }
        }
Пример #3
0
		public static IEndpointCache New([NotNull] Action<EndpointFactoryConfigurator> configure)
		{
			Guard.AgainstNull(configure, "configure");

			var configurator = new EndpointFactoryConfiguratorImpl(_defaultSettings);

			configure(configurator);

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

			try
			{
				IEndpointFactory endpointFactory = configurator.CreateEndpointFactory();

				IEndpointCache endpointCache = new EndpointCache(endpointFactory);

				return endpointCache;
			}
			catch (Exception ex)
			{
				throw new ConfigurationException(result, "An exception was thrown during endpoint cache creation", ex);
			}
		}
        public void ActivityTextFixtureSetup()
        {
            if (_endpointFactoryConfigurator != null)
            {
                ConfigurationResult result =
                    ConfigurationResultImpl.CompileResults(_endpointFactoryConfigurator.Validate());

                try
                {
                    EndpointFactory = _endpointFactoryConfigurator.CreateEndpointFactory();

                    _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(50.Milliseconds());
                x.EnableAutoStart();
            });

            LocalUri = new Uri(BaseUri, "local");

            SetupActivities();

            LocalBus = CreateServiceBus(ConfigureLocalBus);
        }