public void ActivityTestFixtureFixtureTeardown()
        {
            foreach (ActivityTestContext activityTestContext in ActivityTestContexts.Values)
            {
                activityTestContext.Dispose();
            }

            LocalBus.Dispose();

            if (_cancellationTokenSource != null)
            {
                _cancellationTokenSource.Dispose();
            }
            if (_timer != null)
            {
                _timer.Dispose();
            }

            _endpointCache.Clear();

            if (EndpointCache != null)
            {
                EndpointCache.Dispose();
                EndpointCache = null;
            }

            ServiceBusFactory.ConfigureDefaultSettings(x => { x.SetEndpointCache(null); });
        }
示例#2
0
        public IServiceBus CreateServiceBus()
        {
            _log.InfoFormat("MassTransit v{0}, .NET Framework v{1}",
                            typeof(ServiceBusFactory).Assembly.GetName().Version,
                            Environment.Version);

            IEndpointCache endpointCache = CreateEndpointCache();

            _settings.EndpointCache = endpointCache;

            BusBuilder builder = _builderFactory(_settings);

            _subscriptionRouterConfigurator.SetNetwork(_settings.Network);

            // run through all configurators that have been set and let
            // them do their magic
            foreach (BusBuilderConfigurator configurator in _configurators)
            {
                builder = configurator.Configure(builder);
            }

            IServiceBus bus = builder.Build();

            return(bus);
        }
        ServiceBus CreateServiceBus(IEndpointCache endpointCache)
        {
            IEndpoint endpoint = endpointCache.GetEndpoint(_settings.InputAddress);

            var serviceBus = new ServiceBus(endpoint, endpointCache);

            return(serviceBus);
        }
示例#4
0
 public AnalysisService(
     IEndpointFactory endpointFactory,
     IEndpointDefinitionFactory endpointDefinitionFactory,
     IEndpointCache endpointCache)
 {
     _endpointFactory           = endpointFactory;
     _endpointDefinitionFactory = endpointDefinitionFactory;
     _endpointCache             = endpointCache;
 }
示例#5
0
 public MainPageController(
     IAnalysisService analysisService,
     IEndpointFactory endpointFactory,
     IInvocationService invocationService,
     IEndpointCache endpointCache)
 {
     _analysisService   = analysisService;
     _endpointFactory   = endpointFactory;
     _invocationService = invocationService;
     _endpointCache     = endpointCache;
 }
示例#6
0
 public void Configuring_an_endpoint_serializer()
 {
     _endpointCache = EndpointCacheFactory.New(x =>
     {
         x.AddTransportFactory <LoopbackTransportFactory>();
         x.ConfigureEndpoint("loopback://localhost/mt_client", y =>
         {
             y.UseSerializer <VersionOneXmlMessageSerializer>()
             .DiscardFaultingMessages();
         });
         x.ConfigureEndpoint("loopback://localhost/mt_other", y => { y.SetErrorAddress("loopback://localhost/mt_error"); });
     });
 }
		public void Configuring_an_endpoint_serializer()
		{
			_endpointCache = EndpointCacheFactory.New(x =>
				{
					x.AddTransportFactory<LoopbackTransportFactory>();
					x.ConfigureEndpoint("loopback://localhost/mt_client", y =>
						{
							y.UseSerializer<VersionOneXmlMessageSerializer>()
								.DiscardFaultingMessages();
						});
					x.ConfigureEndpoint("loopback://localhost/mt_other", y => { y.SetErrorAddress("loopback://localhost/mt_error"); });
				});
		}
		public void Configuring_an_endpoint_serializer()
		{
			_endpointCache = EndpointCacheFactory.New(x =>
			    {
			        x.SetDefaultRetryLimit(5);
			        x.SetDefaultInboundMessageTrackerFactory(retryLimit => new InMemoryInboundMessageTracker(retryLimit));
					x.AddTransportFactory<LoopbackTransportFactory>();
					x.ConfigureEndpoint("loopback://localhost/mt_client", y =>
						{
							y.UseSerializer<VersionOneXmlMessageSerializer>()
								.DiscardFaultingMessages();
						});
					x.ConfigureEndpoint("loopback://localhost/mt_other", y => { y.SetErrorAddress("loopback://localhost/mt_error"); });
				});
		}
示例#9
0
 public void Configuring_an_endpoint_serializer()
 {
     _endpointCache = EndpointCacheFactory.New(x =>
     {
         x.SetDefaultRetryLimit(5);
         x.SetDefaultInboundMessageTrackerFactory(retryLimit => new InMemoryInboundMessageTracker(retryLimit));
         x.AddTransportFactory <LoopbackTransportFactory>();
         x.ConfigureEndpoint("loopback://localhost/mt_client", y =>
         {
             y.UseSerializer <JsonMessageSerializer>()
             .DiscardFaultingMessages();
         });
         x.ConfigureEndpoint("loopback://localhost/mt_other", y => { y.SetErrorAddress("loopback://localhost/mt_error"); });
     });
 }
示例#10
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);
        }
示例#11
0
        /// <summary>
        /// Creates an instance of the ServiceBus, which implements IServiceBus. This is normally
        /// not called and should be created using the ServiceBusConfigurator to ensure proper defaults
        /// and operation.
        /// </summary>
        public ServiceBus(IEndpoint endpointToListenOn,
                          IEndpointCache endpointCache)
        {
            ReceiveTimeout = TimeSpan.FromSeconds(3);
            Guard.AgainstNull(endpointToListenOn, "endpointToListenOn", "This parameter cannot be null");
            Guard.AgainstNull(endpointCache, "endpointFactory", "This parameter cannot be null");

            Endpoint      = endpointToListenOn;
            EndpointCache = endpointCache;

            _eventChannel = new ChannelAdapter();

            _serviceContainer = new ServiceContainer(this);

            OutboundPipeline = new OutboundPipelineConfigurator(this).Pipeline;
            InboundPipeline  = InboundPipelineConfigurator.CreateDefault(this);

            ControlBus = this;

            InitializePerformanceCounters();
        }
示例#12
0
        public IServiceBus CreateServiceBus()
        {
            LogAssemblyVersionInformation();

            IEndpointCache endpointCache = CreateEndpointCache();

            _settings.EndpointCache = endpointCache;

            IBusBuilder builder = _builderFactory(_settings);

            _subscriptionRouterConfigurator.SetNetwork(_settings.Network);

            // run through all configurators that have been set and let
            // them do their magic
            foreach (IBusBuilderConfigurator configurator in _configurators)
            {
                builder = configurator.Configure(builder);
            }

            IServiceBus bus = builder.Build();

            return(bus);
        }
        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);
        }
示例#14
0
        public void SetUp()
        {
            IEndpointCache endpointCache = EndpointCacheFactory.New(x => x.AddTransportFactory <TTransportFactory>());

            _endpoint = endpointCache.GetEndpoint(Address);
        }
 public NotificationSender(Queue notificationEndpoint, IEndpointCache endpointResolver)
 {
     _endpointResolver = endpointResolver;
     _notificationEndpoint = notificationEndpoint;
 }
 public EndpointCacheProxy(IEndpointCache endpointCache)
 {
     _endpointCache = endpointCache;
 }
示例#17
0
 /// <summary>
 /// Returns an IEndpoint for the Uri string specified. If the endpoint has not yet been created,
 /// the factory will attempt to create an endpoint for the Uri string.
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="uriString">The Uri string to resolve to an endpoint (will be checked for valid Uri syntax)</param>
 /// <returns>An IEndpoint instance</returns>
 public static IEndpoint GetEndpoint(this IEndpointCache cache, string uriString)
 {
     return(cache.GetEndpoint(uriString.ToUri("The endpoint URI was invalid")));
 }
 public void SetUp()
 {
     MassTransitEdiDocsOutBootstrapper.Execute();
     StructureMapBootstrapper.Execute();
     _endpointResolver = EndpointCacheFactory.New(ecf => ecf.AddTransportFactory<MsmqTransportFactory>());
 }
示例#19
0
 public void SetUp()
 {
     _endpointCache = EndpointCacheFactory.New(c => { c.AddTransportFactory <TTransportFactory>(); });
     _endpoint      = _endpointCache.GetEndpoint(Address);
 }
示例#20
0
 public NotificationSender(Queue notificationEndpoint, IEndpointCache endpointResolver)
 {
     _endpointResolver     = endpointResolver;
     _notificationEndpoint = notificationEndpoint;
 }
 public void SetEndpointCache(IEndpointCache endpointCache)
 {
     _defaultSettings.EndpointCache = endpointCache;
 }
		public EndpointCacheProxy(IEndpointCache endpointCache)
		{
			_endpointCache = endpointCache;
		}
示例#23
0
        ServiceBus CreateServiceBus(IEndpointCache endpointCache)
        {
            IEndpoint endpoint = endpointCache.GetEndpoint(_settings.InputAddress);

            return(new ServiceBus(endpoint, endpointCache, _settings.EnablePerformanceCounters));
        }
示例#24
0
        public void Should_throw_an_endpoint_exception_from_the_endpoint_factory()
        {
            IEndpointCache endpointCache = EndpointCacheFactory.New(x => { x.AddTransportFactory <MsmqTransportFactory>(); });

            endpointCache.GetEndpoint(_uri);
        }
示例#25
0
 public void SetEndpointCache(IEndpointCache endpointCache)
 {
     _defaultSettings.EndpointCache = endpointCache;
 }
示例#26
0
 public InvocationService(IEndpointCache endpointCache, IConfigHelper configHelper)
 {
     _endpointCache = endpointCache;
     _configHelper  = configHelper;
 }