Esempio n. 1
0
        public void Start(IAppBuilder app)
        {
            WarmupPlugins();


            _log.Debug("Starting ...");
            try
            {
                _compositionRoot.Build(registrar =>
                {
                    LetPluginsRegisterServices(registrar);

                    registrar.RegisterService(x => _cqsBuilder.CreateCommandBus(Container), Lifetime.Singleton);
                    registrar.RegisterService(x => _cqsBuilder.CreateQueryBus(Container), Lifetime.Singleton);
                    registrar.RegisterService(x => _cqsBuilder.CreateEventBus(Container), Lifetime.Singleton);

                    // let us guard it since it runs events in the background.
                    var service = registrar.Registrations.First(x => x.Implements(typeof(IEventBus)));
                    service.AddService(typeof(IApplicationService));

                    registrar.RegisterService(x => _cqsBuilder.CreateRequestReplyBus(Container), Lifetime.Singleton);
                }, Startup.ConfigurationStore);

                BuildServices();
                _appManager.Start();
                _backgroundJobManager.Start();
                _log.Debug("...started");
            }
            catch (Exception exception)
            {
                _log.Error("Failed to start.", exception);
                throw;
            }
        }
        public void Start()
        {
            _log.Debug("Starting ...");
            try
            {
                _compositionRoot.Build(registrar =>
                {
                    registrar.RegisterService(x => _cqsBuilder.CreateCommandBus(Container), Lifetime.Singleton);
                    registrar.RegisterService(x => _cqsBuilder.CreateQueryBus(Container), Lifetime.Singleton);
                    registrar.RegisterService(x => _cqsBuilder.CreateEventBus(Container), Lifetime.Singleton);
                    registrar.RegisterService(x => _cqsBuilder.CreateRequestReplyBus(Container), Lifetime.Singleton);
                });
                BuildServices();
                ConfigureDataMapper();

                _appManager.Start();
                _backgroundJobManager.Start();
                _log.Debug("...started");
            }
            catch (Exception exception)
            {
                _log.Error("Failed to start.", exception);
                throw;
            }
        }