Beispiel #1
0
        private static void InitializeEQueue()
        {
            _ecommonConfiguration = ECommonConfiguration
                                    .Create()
                                    .UseAutofac()
                                    .RegisterCommonComponents()
                                    .UseLog4Net()
                                    .UseJsonNet()
                                    .RegisterUnhandledExceptionHandler()
                                    .RegisterEQueueComponents()
                                    .BuildContainer();

            ServiceConfigSettings.Initialize();

            var brokerSetting = new BrokerSetting(false, ServiceConfigSettings.EqueueStorePath)
            {
                NameServerList = ServiceConfigSettings.NameServerEndpoints
            };

            brokerSetting.BrokerInfo.ProducerAddress = ServiceConfigSettings.BrokerProducerServiceAddress;
            brokerSetting.BrokerInfo.ConsumerAddress = ServiceConfigSettings.BrokerConsumerServiceAddress;
            brokerSetting.BrokerInfo.AdminAddress    = ServiceConfigSettings.BrokerAdminServiceAddress;
            brokerSetting.BrokerInfo.BrokerName      = ServiceConfigSettings.BrokerName;
            brokerSetting.BrokerInfo.GroupName       = ServiceConfigSettings.BrokerGroup;

            _broker = BrokerController.Create(brokerSetting);
            ObjectContainer.Resolve <ILoggerFactory>().Create(typeof(Program).FullName).Info("Broker initialized.");
        }
Beispiel #2
0
        private static void InitializeENode()
        {
            int minWorker, minIOC;

            // Get the current settings.
            ThreadPool.GetMinThreads(out minWorker, out minIOC);
            // Change the minimum number of worker threads to four, but
            // keep the old setting for minimum asynchronous I/O
            // completion threads.
            ThreadPool.SetMinThreads(250, minIOC);

            ServiceConfigSettings.Initialize();
            DataConfigSettings.Initialize();

            var assemblies = new[]
            {
                Assembly.Load("Lottery.Infrastructure"),
                Assembly.Load("Lottery.Commands"),
                Assembly.Load("Lottery.Core"),
                Assembly.Load("Lottery.Denormalizers.Dapper"),
                Assembly.Load("Lottery.ProcessManagers"),
                Assembly.Load("Lottery.EventService")
            };

            _enodeConfiguration = Configuration
                                  .Create()
                                  .UseAutofac()
                                  .RegisterCommonComponents()
                                  .UseLog4Net()
                                  .UseJsonNet()
                                  .RegisterUnhandledExceptionHandler()
                                  .CreateENode()
                                  .RegisterENodeComponents()
                                  .RegisterBusinessComponents(assemblies)
                                  .UseSqlServerPublishedVersionStore()
                                  .UseEQueue()
                                  .UseRedisCache()
                                  .BuildContainer()
                                  .InitializeSqlServerPublishedVersionStore(DataConfigSettings.ENodeConnectionString)
                                  .InitializeBusinessAssemblies(assemblies);

            ObjectContainer.Resolve <ILoggerFactory>().Create(typeof(Program)).Info("Event service initialized.");
        }
Beispiel #3
0
        protected static void Initialize()
        {
            if (_enodeConfiguration != null)
            {
                CleanupEnode();
            }

            ServiceConfigSettings.Initialize();
            DataConfigSettings.Initialize();

            InitializeENode();

            _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(typeof(TestBase));
            _logger.Info("ENode initialized.");

            _commandService = ObjectContainer.Resolve <ICommandService>();

            //ObjectContainer.Resolve<ILockService>().AddLockKey(typeof(LotteryData).Name);
        }
Beispiel #4
0
        private void InitializeENode()
        {
            ServiceConfigSettings.Initialize();
            DataConfigSettings.Initialize();

            var assemblies = new[]
            {
                Assembly.Load("Lottery.Infrastructure"),
                Assembly.Load("Lottery.Commands"),
                Assembly.Load("Lottery.QueryServices"),
                Assembly.Load("Lottery.QueryServices.Dapper"),
                Assembly.Load("Lottery.AppService"),
                Assembly.Load("Lottery.WebApi")
            };

            Configuration
            .Create()
            .UseAutofac()
            .RegisterCommonComponents()
            .UseLog4Net()
            .UseJsonNet()
            .RegisterUnhandledExceptionHandler()
            .CreateENode()
            .RegisterENodeComponents()
            .RegisterBusinessComponents(assemblies)
            .UseEQueue()
            .UseRedisCache()
            .UseAutoMapper("Lottery.Dtos")
            .UseSqlServerPublishedVersionStore()
            .BuildContainer()
            .ClearCache()
            .InitEmailSeting()
            .InitializeBusinessAssemblies(assemblies)
            .InitLotteryEngine()
            .InitializeSqlServerPublishedVersionStore(DataConfigSettings.ENodeConnectionString)
            .StartEQueue()
            .Start();

            _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType());
            _logger.Info("ENode initialized.");
        }
Beispiel #5
0
        private static void InitializeEQueue()
        {
            _ecommonConfiguration = ECommonConfiguration
                                    .Create()
                                    .UseAutofac()
                                    .RegisterCommonComponents()
                                    .UseLog4Net()
                                    .UseJsonNet()
                                    .RegisterUnhandledExceptionHandler()
                                    .RegisterEQueueComponents()
                                    .BuildContainer();

            ServiceConfigSettings.Initialize();
            var setting = new NameServerSetting()
            {
                BindingAddress = ServiceConfigSettings.NameServerAddress
            };

            _nameServer = new NameServerController(setting);
            ObjectContainer.Resolve <ILoggerFactory>().Create(typeof(Bootstrap).FullName).Info("NameServer initialized.");
        }
Beispiel #6
0
        private static void InitializeENode()
        {
            ServiceConfigSettings.Initialize();
            DataConfigSettings.Initialize();

            var assemblies = new[]
            {
                Assembly.Load("Lottery.Infrastructure"),
                Assembly.Load("Lottery.Commands"),
                Assembly.Load("Lottery.Core"),
                Assembly.Load("Lottery.Denormalizers.Dapper"),
                Assembly.Load("Lottery.CommandHandlers"),
                Assembly.Load("Lottery.CommandService"),
            };

            // var setting = new ConfigurationSetting(DataConfigSettings.ENodeConnectionString);

            _enodeConfiguration = Configuration
                                  .Create()
                                  .UseAutofac()
                                  .RegisterCommonComponents()
                                  .UseLog4Net()
                                  .UseJsonNet()
                                  .RegisterUnhandledExceptionHandler()
                                  .CreateENode()
                                  .RegisterENodeComponents()
                                  .RegisterBusinessComponents(assemblies)
                                  .UseSqlServerEventStore()
                                  .UseSqlServerLockService()
                                  .UseEQueue()
                                  .UseRedisCache()
                                  .BuildContainer()
                                  .InitializeBusinessAssemblies(assemblies)
                                  .InitializeSqlServerEventStore(DataConfigSettings.ENodeConnectionString)
                                  .InitializeSqlServerLockService(DataConfigSettings.ENodeConnectionString)
                                  .Start();
        }
Beispiel #7
0
 public static void InitializeFramework()
 {
     ServiceConfigSettings.Initialize();
     DataConfigSettings.Initialize();
     InitializeENodeFramework();
 }