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); } }
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 UseSqlServerQueueStore(this Configuration configuration, SqlServerQueueStoreSetting setting) { configuration.SetDefault<IQueueStore, SqlServerQueueStore>(new SqlServerQueueStore(setting)); return configuration; }
public SqlServerQueueStore(SqlServerQueueStoreSetting setting) { _setting = setting; _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName); }
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."); }
public SqlServerQueueStore(SqlServerQueueStoreSetting setting) { _setting = setting; _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); }
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."); }