Exemple #1
0
        private void InitializeEQueue()
        {
            ConfigSettings.Initialize();

            var messageStoreSetting = new SqlServerMessageStoreSetting
            {
                ConnectionString = ConfigSettings.ConnectionString,
                DeleteMessageHourOfDay = -1
            };
            var offsetManagerSetting = new SqlServerOffsetManagerSetting
            {
                ConnectionString = ConfigSettings.ConnectionString
            };

            Configuration
                .Create()
                .UseAutofac()
                .RegisterCommonComponents()
                .UseLog4Net()
                .UseJsonNet()
                .RegisterEQueueComponents()
                .UseSqlServerMessageStore(messageStoreSetting)
                .UseSqlServerOffsetManager(offsetManagerSetting);

            _broker = new BrokerController();
        }
 public SqlServerOffsetManager(SqlServerOffsetManagerSetting setting)
 {
     _setting = setting;
     _scheduleService = ObjectContainer.Resolve<IScheduleService>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     _getLatestVersionSQL = "select max(Version) from [" + _setting.QueueOffsetTable + "]";
     _getLatestVersionQueueOffsetSQL = "select * from [" + _setting.QueueOffsetTable + "] where Version = {0}";
     _insertNewVersionQueueOffsetSQLFormat = "insert into [" + _setting.QueueOffsetTable + "] (Version,ConsumerGroup,Topic,QueueId,QueueOffset,Timestamp) values ({0},'{1}','{2}',{3},{4},'{5}')";
     _deleteOldVersionQueueOffsetSQLFormat = "delete from [" + _setting.QueueOffsetTable + "] where Version = {0}";
 }
 public SqlServerOffsetManager(SqlServerOffsetManagerSetting setting)
 {
     _setting                              = setting;
     _scheduleService                      = ObjectContainer.Resolve <IScheduleService>();
     _logger                               = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName);
     _getLatestVersionSQL                  = "select max(Version) from [" + _setting.QueueOffsetTable + "]";
     _getLatestVersionQueueOffsetSQL       = "select * from [" + _setting.QueueOffsetTable + "] where Version = {0}";
     _insertNewVersionQueueOffsetSQLFormat = "insert into [" + _setting.QueueOffsetTable + "] (Version,ConsumerGroup,Topic,QueueId,QueueOffset,Timestamp) values ({0},'{1}','{2}',{3},{4},'{5}')";
     _deleteOldVersionQueueOffsetSQLFormat = "delete from [" + _setting.QueueOffsetTable + "] where Version = {0}";
 }
Exemple #4
0
        static void InitializeEQueue()
        {
            var configuration = ECommonConfiguration
                .Create()
                .UseAutofac()
                .RegisterCommonComponents()
                .UseLog4Net()
                .UseJsonNet()
                .RegisterUnhandledExceptionHandler()
                .RegisterEQueueComponents();

            var persistMode = ConfigurationManager.AppSettings["persistMode"];
            var maxCacheMessageSize = int.Parse(ConfigurationManager.AppSettings["maxCacheMessageSize"]);

            if (persistMode == "in-memory")
            {
                configuration.UseInMemoryMessageStore(new InMemoryMessageStoreSetting { MessageMaxCacheSize = maxCacheMessageSize });
            }
            else if (persistMode == "sql")
            {
                var connectionString = ConfigurationManager.AppSettings["connectionString"];
                var persistMessageInterval = int.Parse(ConfigurationManager.AppSettings["persistMessageInterval"]);
                var persistMessageMaxCount = int.Parse(ConfigurationManager.AppSettings["persistMessageMaxCount"]);
                var messageLogFile = ConfigurationManager.AppSettings["messageLogFile"];

                var queueStoreSetting = new SqlServerQueueStoreSetting
                {
                    ConnectionString = connectionString
                };
                var messageStoreSetting = new SqlServerMessageStoreSetting
                {
                    ConnectionString = connectionString,
                    PersistMessageInterval = persistMessageInterval,
                    PersistMessageMaxCount = persistMessageMaxCount,
                    MessageLogFile = messageLogFile,
                    MessageMaxCacheSize = maxCacheMessageSize
                };
                var offsetManagerSetting = new SqlServerOffsetManagerSetting
                {
                    ConnectionString = connectionString
                };

                configuration
                    .UseSqlServerQueueStore(queueStoreSetting)
                    .UseSqlServerMessageStore(messageStoreSetting)
                    .UseSqlServerOffsetManager(offsetManagerSetting);
            }
        }
        public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration)
        {
            var configuration = enodeConfiguration.GetCommonConfiguration();
            string dbConfig = System.Configuration.ConfigurationManager.ConnectionStrings["IntDbConn"].ConnectionString;
            var messageStoreSetting = new SqlServerMessageStoreSetting
            {
                ConnectionString = dbConfig,
                DeleteMessageHourOfDay = -1
            };
            var offsetManagerSetting = new SqlServerOffsetManagerSetting
            {
                ConnectionString = dbConfig
            };

            configuration
                .RegisterEQueueComponents()
                .UseSqlServerMessageStore(messageStoreSetting)
                .UseSqlServerOffsetManager(offsetManagerSetting);

            _broker = new BrokerController();
            _commandResultProcessor = new CommandResultProcessor();
            _commandService = new CommandService(_commandResultProcessor);
            _eventPublisher = new EventPublisher();

            configuration.SetDefault<ICommandService, CommandService>(_commandService);
            configuration.SetDefault<IPublisher<EventStream>, EventPublisher>(_eventPublisher);
            configuration.SetDefault<IPublisher<DomainEventStream>, EventPublisher>(_eventPublisher);
            configuration.SetDefault<IPublisher<IEvent>, EventPublisher>(_eventPublisher);

            _commandConsumer = new CommandConsumer();
            _eventConsumer = new EventConsumer();

            var commandTopics = ObjectContainer.Resolve<ITopicProvider<ICommand>>().GetAllTopics();
            var eventTopics = ObjectContainer.Resolve<ITopicProvider<IEvent>>().GetAllTopics();
            commandTopics.ForEach(topic => _commandConsumer.Subscribe(topic));
            eventTopics.ForEach(topic => _eventConsumer.Subscribe(topic));

            return enodeConfiguration;
        }
Exemple #6
0
        static void InitializeEQueue()
        {
            var configuration = ECommonConfiguration
                .Create()
                .UseAutofac()
                .RegisterCommonComponents()
                .UseLog4Net()
                .UseJsonNet()
                .RegisterUnhandledExceptionHandler()
                .RegisterEQueueComponents();

            var persistMode = ConfigurationManager.AppSettings["persistMode"];

            if (persistMode == "sql")
            {
                var connectionString = ConfigurationManager.AppSettings["connectionString"];
                var messageLogFile = ConfigurationManager.AppSettings["messageLogFile"];

                var queueStoreSetting = new SqlServerQueueStoreSetting
                {
                    ConnectionString = connectionString
                };
                var messageStoreSetting = new SqlServerMessageStoreSetting
                {
                    ConnectionString = connectionString,
                    MessageLogFile = messageLogFile
                };
                var offsetManagerSetting = new SqlServerOffsetManagerSetting
                {
                    ConnectionString = connectionString
                };

                configuration
                    .UseSqlServerQueueStore(queueStoreSetting)
                    .UseSqlServerMessageStore(messageStoreSetting)
                    .UseSqlServerOffsetManager(offsetManagerSetting);
            }
        }
 public static Configuration UseSqlServerOffsetManager(this Configuration configuration, SqlServerOffsetManagerSetting setting)
 {
     configuration.SetDefault<IOffsetManager, SqlServerOffsetManager>(new SqlServerOffsetManager(setting));
     return configuration;
 }
Exemple #8
0
        private static void InitializeEQueue()
        {
            ConfigSettings.Initialize();

            var messageStoreSetting = new SqlServerMessageStoreSetting
            {
                ConnectionString = ConfigSettings.ConnectionString,
                DeleteMessageHourOfDay = -1
            };
            var offsetManagerSetting = new SqlServerOffsetManagerSetting
            {
                ConnectionString = ConfigSettings.ConnectionString
            };

            _ecommonConfiguration
                .RegisterEQueueComponents()
                .UseSqlServerMessageStore(messageStoreSetting)
                .UseSqlServerOffsetManager(offsetManagerSetting);

            _broker = new BrokerController();
            _logger.Info("EQueue initialized.");
        }
Exemple #9
0
        private static void InitializeEQueue()
        {
            ConfigSettings.Initialize();

            var queueStoreSetting = new SqlServerQueueStoreSetting
            {
                ConnectionString = ConfigSettings.ConferenceEQueueConnectionString
            };
            var messageStoreSetting = new SqlServerMessageStoreSetting
            {
                ConnectionString = ConfigSettings.ConferenceEQueueConnectionString,
                MessageLogFilePath = "/home/admin/logs/conference/equeue"
            };
            var offsetManagerSetting = new SqlServerOffsetManagerSetting
            {
                ConnectionString = ConfigSettings.ConferenceEQueueConnectionString
            };

            _configuration
                .RegisterEQueueComponents()
                .UseSqlServerQueueStore(queueStoreSetting)
                .UseSqlServerMessageStore(messageStoreSetting)
                .UseSqlServerOffsetManager(offsetManagerSetting);

            var setting = new BrokerSetting
            {
                ProducerIPEndPoint = new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.BrokerProducerPort),
                ConsumerIPEndPoint = new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.BrokerConsumerPort),
                AdminIPEndPoint = new IPEndPoint(SocketUtils.GetLocalIPV4(), ConfigSettings.BrokerAdminPort)
            };
            _broker = BrokerController.Create(setting);
            _logger.Info("EQueue initialized.");
        }
        private void InitializeEQueue()
        {
            string dbConfig = System.Configuration.ConfigurationManager.ConnectionStrings["IntDbConn"].ConnectionString;

            var messageStoreSetting = new SqlServerMessageStoreSetting
            {
                ConnectionString = dbConfig,
                DeleteMessageHourOfDay = -1
            };
            var offsetManagerSetting = new SqlServerOffsetManagerSetting
            {
                ConnectionString = dbConfig
            };

            _ecommonConfiguration
                .RegisterEQueueComponents()
                .UseSqlServerMessageStore(messageStoreSetting)
                .UseSqlServerOffsetManager(offsetManagerSetting);

            _broker = new BrokerController();
        }
Exemple #11
0
        private static void InitializeEQueue()
        {
            ConfigSettings.Initialize();

            var queueStoreSetting = new SqlServerQueueStoreSetting
            {
                ConnectionString = ConfigSettings.ConnectionString
            };
            var messageStoreSetting = new SqlServerMessageStoreSetting
            {
                ConnectionString = ConfigSettings.ConnectionString,
                MessageLogFilePath = "/equeue_message_logs"
            };
            var offsetManagerSetting = new SqlServerOffsetManagerSetting
            {
                ConnectionString = ConfigSettings.ConnectionString
            };

            _ecommonConfiguration
                .RegisterEQueueComponents()
                .UseSqlServerQueueStore(queueStoreSetting)
                .UseSqlServerMessageStore(messageStoreSetting)
                .UseSqlServerOffsetManager(offsetManagerSetting);

            _broker = BrokerController.Create();
            _logger.Info("EQueue initialized.");
        }