コード例 #1
0
        public ITimeoutManager Create()
        {
            var timeoutManager = new MySqlTimeoutManager(MySqlTestHelper.ConnectionHelper, "timeouts", new ConsoleLoggerFactory(false));

            timeoutManager.EnsureTableIsCreated();
            return(timeoutManager);
        }
コード例 #2
0
        public ITimeoutManager Create()
        {
            var timeoutManager = new MySqlTimeoutManager(MySqlTestHelper.ConnectionHelper, "timeouts", new ConsoleLoggerFactory(false), _fakeRebusTime);

            AsyncHelpers.RunSync(() => timeoutManager.EnsureTableIsCreated());
            return(timeoutManager);
        }
        /// <summary>
        /// Configures Rebus to use MySQL to store timeouts.
        /// </summary>
        public static void StoreInMySql(this StandardConfigurer <ITimeoutManager> configurer, MySqlTimeoutManagerOptions options, string tableName)
        {
            if (configurer == null)
            {
                throw new ArgumentNullException(nameof(configurer));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }

            configurer.Register(c =>
            {
                var rebusTime           = c.Get <IRebusTime>();
                var rebusLoggerFactory  = c.Get <IRebusLoggerFactory>();
                var connectionProvider  = options.ConnectionProviderFactory(c);
                var subscriptionStorage = new MySqlTimeoutManager(connectionProvider, tableName, rebusLoggerFactory, rebusTime);

                if (options.EnsureTablesAreCreated)
                {
                    subscriptionStorage.EnsureTableIsCreated();
                }

                return(subscriptionStorage);
            });
        }
        /// <summary>
        /// Configures Rebus to use MySQL to store timeouts.
        /// </summary>
        public static void StoreInMySql(this StandardConfigurer <ITimeoutManager> configurer,
                                        Func <Task <IDbConnection> > connectionFactory, string tableName, bool automaticallyCreateTables = true)
        {
            if (configurer == null)
            {
                throw new ArgumentNullException(nameof(configurer));
            }
            if (connectionFactory == null)
            {
                throw new ArgumentNullException(nameof(connectionFactory));
            }
            if (tableName == null)
            {
                throw new ArgumentNullException(nameof(tableName));
            }

            configurer.Register(c =>
            {
                var rebusTime           = c.Get <IRebusTime>();
                var rebusLoggerFactory  = c.Get <IRebusLoggerFactory>();
                var connectionProvider  = new DbConnectionFactoryProvider(connectionFactory);
                var subscriptionStorage = new MySqlTimeoutManager(connectionProvider, tableName, rebusLoggerFactory, rebusTime);

                if (automaticallyCreateTables)
                {
                    subscriptionStorage.EnsureTableIsCreated();
                }

                return(subscriptionStorage);
            });
        }
コード例 #5
0
        public ITimeoutManager Create()
        {
            var consoleLoggerFactory = new ConsoleLoggerFactory(true);
            var connectionProvider   = new DbConnectionProvider(MySqlTestHelper.ConnectionString, consoleLoggerFactory);
            var timeoutManager       = new MySqlTimeoutManager(connectionProvider, TableName, consoleLoggerFactory, _fakeRebusTime);

            timeoutManager.EnsureTableIsCreated();

            return(timeoutManager);
        }
コード例 #6
0
        /// <summary>
        /// Configures Rebus to use MySQL to store timeouts.
        /// </summary>
        public static void StoreInMySql(this StandardConfigurer <ITimeoutManager> configurer, string connectionString, string tableName, bool automaticallyCreateTables = true)
        {
            configurer.Register(c =>
            {
                var rebusLoggerFactory  = c.Get <IRebusLoggerFactory>();
                var subscriptionStorage = new MySqlTimeoutManager(new MySqlConnectionHelper(connectionString), tableName, rebusLoggerFactory);

                if (automaticallyCreateTables)
                {
                    AsyncHelpers.RunSync(() => subscriptionStorage.EnsureTableIsCreated());
                }

                return(subscriptionStorage);
            });
        }