Пример #1
0
        public static void BootstrapCronus(IServiceProvider serviceProvider)
        {
            CronusLogger.Configure(serviceProvider.GetService <ILoggerFactory>());
            var scanner = new CronusStartupScanner(new DefaulAssemblyScanner());
            IEnumerable <Type> startups = scanner.Scan();

            foreach (var startupType in startups)
            {
                ICronusStartup startup = (ICronusStartup)serviceProvider.GetRequiredService(startupType);
                startup.Bootstrap();
            }
        }
Пример #2
0
        public void Start()
        {
            try
            {
                CronusLogger.Configure(serviceProvider.GetService<ILoggerFactory>());

                booter.BootstrapCronus();

                if (hostOptions.ApplicationServicesEnabled) appServices.Start();
                if (hostOptions.SagasEnabled) sagas.Start();
                if (hostOptions.ProjectionsEnabled) projections.Start();
                if (hostOptions.PortsEnabled) ports.Start();
                if (hostOptions.GatewaysEnabled) gateways.Start();
                if (hostOptions.TriggersEnabled) triggers.Start();
                if (hostOptions.MigrationsEnabled) migrations.Start();

                if (hostOptions.SystemServicesEnabled)
                {
                    indices.Start();
                    systemIndices.Start();
                    systemAppServices.Start();
                    systemPorts.Start();
                    systemProjections.Start();
                    systemSagas.Start();
                    systemTriggers.Start();
                }

                if (hostOptions.RpcApiEnabled)
                {
                    rpcHost.Start();
                }

            }
            catch (Exception ex)
            {
                logger.CriticalException(ex, () => $"Start: {ex.Message}");
                throw;
            }
        }