Example #1
0
        public void Setup()
        {
            ObjectBuilder = MockRepository.GenerateMock <IObjectBuilder>();

            XmlMessageSerializer serializer = new XmlMessageSerializer();

            ObjectBuilder.Stub(x => x.GetInstance <XmlMessageSerializer>()).Return(serializer);

            EndpointFactory = EndpointFactoryConfigurator.New(x =>
            {
                x.SetObjectBuilder(ObjectBuilder);
                x.RegisterTransport <TTransport>();
                x.SetDefaultSerializer <XmlMessageSerializer>();

                AdditionalEndpointFactoryConfiguration(x);
            });
            ObjectBuilder.Stub(x => x.GetInstance <IEndpointFactory>()).Return(EndpointFactory);

            ServiceBusConfigurator.Defaults(x =>
            {
                x.SetObjectBuilder(ObjectBuilder);
                x.SetReceiveTimeout(500.Milliseconds());
                x.SetConcurrentConsumerLimit(Environment.ProcessorCount * 2);
            });

            EstablishContext();
        }
Example #2
0
        private static void Main()
        {
            /////setup
            XmlConfigurator.ConfigureAndWatch(new FileInfo("log4net.xml"));

            WindsorContainer c  = new DefaultMassTransitContainer();
            IEndpointFactory ef = EndpointFactoryConfigurator.New(e => e.RegisterTransport <MsmqEndpoint>());

            c.Kernel.AddComponentInstance("endpointFactory", typeof(IEndpointFactory), ef);
            c.AddComponent <SimpleMessageHandler>();
            c.AddComponentLifeStyle("counter", typeof(Counter), LifestyleType.Singleton);
            c.AddComponentLifeStyle("rvaoeuaoe", typeof(CacheUpdateResponseHandler), LifestyleType.Transient);

            IServiceBus bus = ServiceBusConfigurator.New(b =>
            {
                b.ReceiveFrom("msmq://localhost/mt_client");
                b.ConfigureService <SubscriptionClientConfigurator>(sc => sc.SetSubscriptionServiceEndpoint("msmq://localhost/mt_subscriptions"));
                b.ConfigureService <HealthClientConfigurator>(hc => hc.SetHeartbeatInterval(10));
            });

            c.Kernel.AddComponentInstance("bus", typeof(IServiceBus), bus);

            bus.Subscribe <CacheUpdateResponseHandler>();
            bus.Subscribe <SimpleMessageHandler>();

            IEndpoint ep            = c.Resolve <IEndpointFactory>().GetEndpoint(new Uri("msmq://localhost/mt_subscriptions"));
            var       subTester     = new SubscriptionServiceTester(ep, bus, c.Resolve <Counter>());
            var       healthTester  = new HealthServiceTester(c.Resolve <Counter>(), bus);
            var       timeoutTester = new TimeoutTester(bus);

            bus.Subscribe(healthTester);
            ///////


            Console.WriteLine("Please enter the number of hours you would like this test to run for?");
            Console.WriteLine("(use 0.1 for 6 minutes)");
            Console.WriteLine("(use 0.016 for 1 minute)");
            string   input    = Console.ReadLine();
            double   hours    = double.Parse(input ?? "0");
            DateTime stopTime = DateTime.Now.AddHours(hours);


            Console.WriteLine("Test Started");
            var rand = new Random();

            while (DateTime.Now < stopTime)
            {
                subTester.Test();
                healthTester.Test();
                timeoutTester.Test();

                Thread.Sleep(rand.Next(5, 10) * 1000);
                PrintTime(bus, c.Resolve <Counter>());
            }

            //print final stuff (probably do this by tester)
            subTester.Results();
            Console.WriteLine("Done (press any key to exit)");
            Console.ReadKey(true);
        }
Example #3
0
        public DoWork(IObjectBuilder objectBuilder)
        {
            ObjectBuilder = objectBuilder;

            var endpointFactory = EndpointFactoryConfigurator.New(x =>
            {
                x.RegisterTransport <MsmqEndpoint>();
                x.SetObjectBuilder(objectBuilder);
                x.SetDefaultSerializer <XmlMessageSerializer>();
            });

            ControlBus = ControlBusConfigurator.New(x =>
            {
                x.SetObjectBuilder(ObjectBuilder);

                x.ReceiveFrom(new Uri(ConfigurationManager.AppSettings["SourceQueue"]).AppendToPath("_control"));

                x.PurgeBeforeStarting();
            });

            DataBus = ServiceBusConfigurator.New(x =>
            {
                x.SetObjectBuilder(ObjectBuilder);
                x.ConfigureService <SubscriptionClientConfigurator>(y =>
                {
                    y.SetSubscriptionServiceEndpoint(ConfigurationManager.AppSettings["SubscriptionQueue"]);
                });
                x.ReceiveFrom(ConfigurationManager.AppSettings["SourceQueue"]);
                x.UseControlBus(ControlBus);
                x.SetConcurrentConsumerLimit(4);
                x.ImplementDistributorWorker <DoSimpleWorkItem>(ConsumeMessage);
            });
        }
Example #4
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();
            });
        }
Example #5
0
        protected EndpointTestFixture()
        {
            var defaultSettings = new EndpointFactoryDefaultSettings();

            _endpointFactoryConfigurator = new EndpointFactoryConfigurator(defaultSettings);
            _endpointFactoryConfigurator.AddTransportFactory <TTransportFactory>();
            _endpointFactoryConfigurator.SetPurgeOnStartup(true);
        }
Example #6
0
        public static EndpointFactoryConfigurator SetPurgeOnStartup(this EndpointFactoryConfigurator configurator, bool value)
        {
            var builderConfigurator = new DelegateEndpointFactoryBuilderConfigurator(x => x.SetPurgeOnStartup(value));

            configurator.AddEndpointFactoryConfigurator(builderConfigurator);

            return(configurator);
        }
Example #7
0
        public void Should_throw_an_endpoint_exception_from_the_endpoint_factory()
        {
            IEndpointFactory ef = EndpointFactoryConfigurator.New(x =>
            {
                x.RegisterTransport <MsmqEndpoint>();
            });

            ef.GetEndpoint(_uri);
        }
Example #8
0
        public static EndpointFactoryConfigurator SetCreateTransactionalQueues(this EndpointFactoryConfigurator configurator,
                                                                               bool value)
        {
            var builderConfigurator = new DelegateEndpointFactoryBuilderConfigurator(x => x.SetCreateTransactionalQueues(value));

            configurator.AddEndpointFactoryConfigurator(builderConfigurator);

            return(configurator);
        }
 public void SetUp()
 {
     _endpointFactory = EndpointFactoryConfigurator.New(c =>
     {
         c.RegisterTransport <TEndpoint>();
         c.SetObjectBuilder(ObjectBuilder);
     });
     _ep = _endpointFactory.GetEndpoint(Address);
 }
Example #10
0
        /// <summary>
        /// c'tor that sets up the endpoint configurator, its default settings,
        /// and uses the class type parameter <see cref="TTransportFactory"/>
        /// as the transport for that endpoint.
        /// </summary>
        protected EndpointTestFixture()
        {
            Buses = new List <IServiceBus>();

            var defaultSettings = new EndpointFactoryDefaultSettings();

            EndpointFactoryConfigurator = new EndpointFactoryConfigurator(defaultSettings);
            EndpointFactoryConfigurator.AddTransportFactory <TTransportFactory>();
            EndpointFactoryConfigurator.SetPurgeOnStartup(true);
        }
        /// <summary>
        /// <para>This method specifies that the service bus under configuration is to
        /// use RabbitMQ for message queueing. See http://readthedocs.org/docs/masstransit/en/latest/configuration/transports/rabbitmq.html.
        /// This method also calls <see cref="SerializerConfigurationExtensions.UseJsonSerializer{T}"/>.</para>
        ///
        /// </summary>
        /// <typeparam name="T">configurator type param</typeparam>
        /// <param name="configurator">configurator instance</param>
        /// <param name="configureFactory">custom action used to call APIs on the configurator</param>
        /// <returns>the configurator instance</returns>
        public static void UseRabbitMq(this EndpointFactoryConfigurator configurator,
                                       Action <RabbitMqTransportFactoryConfigurator> configureFactory)
        {
            var transportFactoryConfigurator = new RabbitMqTransportFactoryConfiguratorImpl();

            configureFactory(transportFactoryConfigurator);

            configurator.AddTransportFactory(transportFactoryConfigurator.Build);

            configurator.UseJsonSerializer();
        }
 protected void RegisterEndpointFactory(Action <IEndpointFactoryConfigurator> configAction)
 {
     Bind <IEndpointFactory>()
     .ToMethod(cxt =>
     {
         return(EndpointFactoryConfigurator.New(x =>
         {
             x.SetObjectBuilder(cxt.Kernel.Get <IObjectBuilder>());
             configAction(x);
         }));
     }).InSingletonScope();
 }
Example #13
0
        public ServiceBusConfiguratorImpl(ServiceBusDefaultSettings defaultSettings)
        {
            _settings = new ServiceBusSettings(defaultSettings);

            _builderFactory = DefaultBuilderFactory;
            _configurators  = new List <BusBuilderConfigurator>();

            _endpointFactoryConfigurator = new EndpointFactoryConfiguratorImpl(new EndpointFactoryDefaultSettings());

            _subscriptionRouterConfigurator = new SubscriptionRouterConfiguratorImpl(_settings.Network);
            _configurators.Add(_subscriptionRouterConfigurator);
        }
        public static EndpointFactoryConfigurator AddTransportFactory <TTransportFactory>(
            this EndpointFactoryConfigurator configurator, Action <TTransportFactory> configureFactory)
            where TTransportFactory : ITransportFactory, new()
        {
            return(AddTransportFactory(configurator, () =>
            {
                var transportFactory = new TTransportFactory();
                configureFactory(transportFactory);

                return transportFactory;
            }));
        }
        public ServiceBusConfiguratorImpl(ServiceBusDefaultSettings defaultSettings)
        {
            _settings = new ServiceBusSettings(defaultSettings);

            _builderFactory = DefaultBuilderFactory;
            _configurators = new List<BusBuilderConfigurator>();

            _endpointFactoryConfigurator = new EndpointFactoryConfiguratorImpl(new EndpointFactoryDefaultSettings());

            _subscriptionRouterConfigurator = new SubscriptionRouterConfiguratorImpl(_settings.Network);
            _configurators.Add(_subscriptionRouterConfigurator);
        }
Example #16
0
        protected virtual void SetupEndpointFactory()
        {
            EndpointFactory = EndpointFactoryConfigurator.New(x =>
            {
                x.SetObjectBuilder(ObjectBuilder);
                x.RegisterTransport <TEndpoint>();
                x.SetDefaultSerializer <XmlMessageSerializer>();

                ConfigureEndpointFactory(x);
            });

            ObjectBuilder.Add(EndpointFactory);
        }
Example #17
0
 protected override void Before_each()
 {
     _builder  = MockRepository.GenerateMock <IObjectBuilder>();
     _resolver = EndpointFactoryConfigurator.New(x =>
     {
         x.SetObjectBuilder(_builder);
         x.SetDefaultSerializer <XmlMessageSerializer>();
         x.RegisterTransport <LoopbackEndpoint>();
     });
     _endpoint = _resolver.GetEndpoint(new Uri("loopback://localhost/servicebus"));
     _bus      = new ServiceBus(_endpoint, _builder, _resolver);
     _bus.Start();
 }
Example #18
0
 protected void RegisterEndpointFactory(Action <IEndpointFactoryConfigurator> configAction)
 {
     For <IEndpointFactory>()
     .Singleton()
     .Use(context =>
     {
         return(EndpointFactoryConfigurator.New(x =>
         {
             x.SetObjectBuilder(context.GetInstance <IObjectBuilder>());
             configAction(x);
         }));
     });
 }
 protected void RegisterEndpointFactory(Action <IEndpointFactoryConfigurator> configAction)
 {
     Kernel.Register(
         Component.For <IEndpointFactory>().UsingFactoryMethod((kernel, context) =>
     {
         return(EndpointFactoryConfigurator.New(x =>
         {
             x.SetObjectBuilder(kernel.Resolve <IObjectBuilder>());
             configAction(x);
         }));
     }).LifeStyle.Singleton
         );
 }
Example #20
0
        protected override void Before_each()
        {
            _builder = MockRepository.GenerateMock <IObjectBuilder>();
            _builder.Stub(x => x.GetInstance <XmlMessageSerializer>()).Return(new XmlMessageSerializer());
            _endpointResolver = EndpointFactoryConfigurator.New(x =>
            {
                x.SetObjectBuilder(_builder);
                x.RegisterTransport <LoopbackEndpoint>();
            });

            _mockEndpoint = _endpointResolver.GetEndpoint(queueUri);

            _subscription = new Subscription(typeof(PingMessage), queueUri);
            _serviceBus   = new ServiceBus(_mockEndpoint, _builder, _endpointResolver);
        }
Example #21
0
        private static void Main(string[] args)
        {
            _log.Info("Server Loading");

            var cfg = RunnerConfigurator.New(c =>
            {
                c.SetServiceName("SampleClientService");
                c.SetDisplayName("SampleClientService");
                c.SetDescription("SampleClientService");
                c.DependencyOnMsmq();
                c.RunAsLocalSystem();


                c.ConfigureService <ClientService>(typeof(ClientService).Name, s =>
                {
                    s.WhenStarted(o =>
                    {
                        var bus = ServiceBusConfigurator.New(servicesBus =>
                        {
                            servicesBus.ReceiveFrom("msmq://localhost/mt_client");
                            servicesBus.ConfigureService <SubscriptionClientConfigurator>(client =>
                            {
                                // need to add the ability to read from configuratino settings somehow
                                client.SetSubscriptionServiceEndpoint("msmq://localhost/mt_subscriptions");
                            });
                        });

                        o.Start(bus);
                    });
                    s.WhenStopped(o => o.Stop());
                    s.CreateServiceLocator(() =>
                    {
                        var container = new DefaultMassTransitContainer();
                        IEndpointFactory endpointFactory = EndpointFactoryConfigurator.New(e =>
                        {
                            e.SetObjectBuilder(ServiceLocator.Current.GetInstance <IObjectBuilder>());
                            e.RegisterTransport <MsmqEndpoint>();
                        });
                        container.Kernel.AddComponentInstance("endpointFactory", typeof(IEndpointFactory), endpointFactory);
                        container.AddComponent <ClientService>(typeof(ClientService).Name);
                        container.AddComponent <PasswordUpdater>();
                        return(ServiceLocator.Current);                                                //set in the DefaultMTContainer
                    });
                });
            });

            Runner.Host(cfg, args);
        }
        public EndpointScenarioBuilderImpl()
        {
            var settings = new EndpointFactoryDefaultSettings
            {
                CreateMissingQueues       = true,
                CreateTransactionalQueues = false,
                PurgeOnStartup            = true,
                RequireTransactional      = false,
                Serializer         = new XmlMessageSerializer(),
                TransactionTimeout = 30.Seconds()
            };

            _endpointFactoryConfigurator = new EndpointFactoryConfiguratorImpl(settings);

            _endpointFactoryConfigurator.AddTransportFactory <LoopbackTransportFactory>();
        }
Example #23
0
 protected override void Before_each()
 {
     _builder         = MockRepository.GenerateMock <IObjectBuilder>();
     _endpointFactory = EndpointFactoryConfigurator.New(x =>
     {
         x.SetObjectBuilder(_builder);
         x.SetDefaultSerializer <XmlMessageSerializer>();
         x.RegisterTransport <LoopbackEndpoint>();
     });
     _builder.Stub(x => x.GetInstance <IEndpointFactory>()).Return(_endpointFactory);
     _bus = ServiceBusConfigurator.New(x =>
     {
         x.SetObjectBuilder(_builder);
         x.ReceiveFrom("loopback://localhost/servicebus");
     });
 }
Example #24
0
        private static void Main(string[] args)
        {
            _log.Info("subscription_mgr Loading...");

            Console.WriteLine("MSMQ Subscription Service");
            var cfg = RunnerConfigurator.New(c =>
            {
                c.SetServiceName("subscription_mgr");
                c.SetDisplayName("Subscription Service");
                c.SetDescription("Coordinates subscriptions between multiple systems");
                c.DependencyOnMsmq();
                c.RunAsLocalSystem();

                c.BeforeStartingServices(s =>
                {
                    var container = new DefaultMassTransitContainer();

                    IEndpointFactory endpointFactory = EndpointFactoryConfigurator.New(e =>
                    {
                        e.SetObjectBuilder(container.Resolve <IObjectBuilder>());
                        e.RegisterTransport <MsmqEndpoint>();
                    });
                    container.Kernel.AddComponentInstance("endpointFactory", typeof(IEndpointFactory), endpointFactory);


                    _wob = new WindsorObjectBuilder(container.Kernel);
                    ServiceLocator.SetLocatorProvider(() => _wob);
                });

                c.ConfigureService <SubscriptionService>(ConfigureSubscriptionService);

                c.ConfigureService <TimeoutService>(ConfigureTimeoutService);

                c.ConfigureService <HealthService>(ConfigureHealthService);
            });

            try
            {
                Runner.Host(cfg, args);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error trying to run service: " + ex);
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
        }
Example #25
0
        private static void Main(string[] args)
        {
            XmlConfigurator.ConfigureAndWatch(new FileInfo("server.log4net.xml"));
            _log.Info("Server Loading");

            IRunConfiguration cfg = RunnerConfigurator.New(c =>
            {
                c.SetServiceName("SampleService");
                c.SetServiceName("Sample Service");
                c.SetServiceName("Something");
                c.DependencyOnMsmq();

                c.RunAsLocalSystem();

                c.ConfigureService <PasswordUpdateService>(typeof(PasswordUpdateService).Name, s =>
                {
                    s.WhenStarted(o =>
                    {
                        IServiceBus bus = ServiceBusConfigurator.New(x =>
                        {
                            x.ReceiveFrom("msmq://localhost/mt_server");
                            x.ConfigureService <SubscriptionClientConfigurator>(b => { b.SetSubscriptionServiceEndpoint("msmq://localhost/mt_subscriptions"); });
                        });
                        o.Start(bus);
                    });
                    s.WhenStopped(o => o.Stop());
                    s.CreateServiceLocator(() =>
                    {
                        var container = new DefaultMassTransitContainer();
                        IEndpointFactory endpointFactory = EndpointFactoryConfigurator
                                                           .New(x =>
                        {
                            x.SetObjectBuilder(ServiceLocator.Current.GetInstance <IObjectBuilder>());
                            x.RegisterTransport <MsmqEndpoint>();
                        });
                        container.Kernel.AddComponentInstance("endpointFactory", typeof(IEndpointFactory), endpointFactory);
                        container.AddComponent <PasswordUpdateService>(typeof(PasswordUpdateService).Name);
                        return(ServiceLocator.Current);                                                //set in DefaultMTContainer
                    });
                });
            });

            Runner.Host(cfg, args);
        }
Example #26
0
        public void Setting_a_specific_message_serializer_on_the_endpoint_should_work()
        {
            var objectBuilder = MockRepository.GenerateMock <IObjectBuilder>();

            var endpointFactory = EndpointFactoryConfigurator.New(x =>
            {
                x.SetObjectBuilder(objectBuilder);
                x.RegisterTransport <LoopbackEndpoint>();

                x.ConfigureEndpoint("loopback://localhost/mt_client", y => { y.SetSerializer <DotNotXmlMessageSerializer>(); });
            });

            objectBuilder.Stub(x => x.GetInstance <IEndpointFactory>()).Return(endpointFactory);
            objectBuilder.Expect(x => x.GetInstance(typeof(DotNotXmlMessageSerializer))).Return(new DotNotXmlMessageSerializer());

            IEndpoint endpoint = endpointFactory.GetEndpoint("loopback://localhost/mt_client");

            objectBuilder.VerifyAllExpectations();
        }
Example #27
0
        private static void ConfigureHealthService(IServiceConfigurator <HealthService> configurator)
        {
            configurator.CreateServiceLocator(() =>
            {
                var container = new DefaultMassTransitContainer();

                container.AddComponent <HealthService>(typeof(HealthService).Name);
                container.AddComponent("sagaRepository", typeof(ISagaRepository <>), typeof(InMemorySagaRepository <>));

                var endpointFactory = EndpointFactoryConfigurator.New(x =>
                {
                    // the default
                    x.SetObjectBuilder(container.Resolve <IObjectBuilder>());
                    x.RegisterTransport <MsmqEndpoint>();
                });

                container.Kernel.AddComponentInstance("endpointFactory", typeof(IEndpointFactory), endpointFactory);

                var bus = ServiceBusConfigurator.New(x =>
                {
                    x.SetObjectBuilder(container.Resolve <IObjectBuilder>());
                    x.ReceiveFrom("msmq://localhost/mt_health");
                    x.ConfigureService <SubscriptionClientConfigurator>(client =>
                    {
                        // need to add the ability to read from configuratino settings somehow
                        client.SetSubscriptionServiceEndpoint("msmq://localhost/mt_subscriptions");
                    });
                });

                container.Kernel.AddComponentInstance("bus", typeof(IServiceBus), bus);

                return(container.Resolve <IObjectBuilder>());
            });

            configurator.WhenStarted(service => { service.Start(); });

            configurator.WhenStopped(service =>
            {
                service.Stop();
                service.Dispose();
            });
        }
Example #28
0
        private static void ConfigureSubscriptionService(IServiceConfigurator <SubscriptionService> configurator)
        {
            configurator.CreateServiceLocator(() =>
            {
                var container = new DefaultMassTransitContainer();

                container.AddComponent("sagaRepository", typeof(ISagaRepository <>), typeof(InMemorySagaRepository <>));

                container.AddComponent <ISubscriptionRepository, InMemorySubscriptionRepository>();
                container.AddComponent <SubscriptionService, SubscriptionService>(typeof(SubscriptionService).Name);

                var endpointFactory = EndpointFactoryConfigurator.New(x =>
                {
                    // the default
                    x.SetObjectBuilder(container.Resolve <IObjectBuilder>());
                    x.RegisterTransport <MsmqEndpoint>();
                });

                container.Kernel.AddComponentInstance("endpointFactory", typeof(IEndpointFactory), endpointFactory);

                var bus = ServiceBusConfigurator.New(servicesBus =>
                {
                    servicesBus.SetObjectBuilder(container.Resolve <IObjectBuilder>());
                    servicesBus.ReceiveFrom("msmq://localhost/mt_subscriptions");
                    servicesBus.SetConcurrentConsumerLimit(1);
                });

                container.Kernel.AddComponentInstance("bus", typeof(IServiceBus), bus);

                return(container.ObjectBuilder);
            });

            configurator.WhenStarted(service => service.Start());

            configurator.WhenStopped(service =>
            {
                service.Stop();
                service.Dispose();
            });
        }
Example #29
0
        private static void Main(string[] args)
        {
            _log.Info("SubscriptionManagerGUI Loading...");

            var cfg = RunnerConfigurator.New(x =>
            {
                x.SetServiceName("SubscriptionManagerGUI");
                x.SetDisplayName("Sample GUI Subscription Service");
                x.SetDescription("Coordinates subscriptions between multiple systems");
                x.DependencyOnMsmq();
                x.RunAsLocalSystem();
                x.UseWinFormHost <SubscriptionManagerForm>();

                x.BeforeStart(s =>
                {
                    var container = new DefaultMassTransitContainer();

                    IEndpointFactory endpointFactory = EndpointFactoryConfigurator.New(e =>
                    {
                        e.SetObjectBuilder(container.Resolve <IObjectBuilder>());
                        e.RegisterTransport <MsmqEndpoint>();
                    });
                    container.Kernel.AddComponentInstance("endpointFactory", typeof(IEndpointFactory), endpointFactory);

                    container.AddComponent <SubscriptionManagerForm>();

                    var wob = new WindsorObjectBuilder(container.Kernel);
                    ServiceLocator.SetLocatorProvider(() => wob);
                });

                x.ConfigureService <SubscriptionService>(ConfigureSubscriptionService);

                x.ConfigureService <TimeoutService>(ConfigureTimeoutService);

                x.ConfigureService <HealthService>(ConfigureHealthService);
            });

            Runner.Host(cfg, args);
        }
Example #30
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 #31
0
 public static EndpointFactoryConfigurator SetSupportedMessageSerializers <T>(
     this EndpointFactoryConfigurator configurator)
     where T : ISupportedMessageSerializers, new()
 {
     return(SetSupportedMessageSerializers(configurator, () => new T()));
 }