Example #1
0
        public MySqlFetchedJob(
            ElasticStorage.ElasticStorage storage,
            IDbConnection connection,
            FetchedJob fetchedJob,
            MySqlStorageOptions storageOptions)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }
            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }
            if (fetchedJob == null)
            {
                throw new ArgumentNullException("fetchedJob");
            }

            _storage        = storage;
            _connection     = connection;
            _storageOptions = storageOptions;
            _id             = fetchedJob.Id;
            JobId           = fetchedJob.JobId.ToString(CultureInfo.InvariantCulture);
            Queue           = fetchedJob.Queue;
        }
Example #2
0
        public MySqlMonitoringApiTests()
        {
            _connection = new MySqlConnection(ConnectionUtils.GetConnectionString());
            _connection.Open();

            var persistentJobQueueMonitoringApiMock = new Mock <IPersistentJobQueueMonitoringApi>();

            persistentJobQueueMonitoringApiMock.Setup(m => m.GetQueues()).Returns(new[] { "default" });

            var defaultProviderMock = new Mock <IPersistentJobQueueProvider>();

            defaultProviderMock.Setup(m => m.GetJobQueueMonitoringApi())
            .Returns(persistentJobQueueMonitoringApiMock.Object);

            var storageOptions = new MySqlStorageOptions
            {
                DashboardJobListLimit = _jobListLimit
            };
            var mySqlStorageMock = new Mock <ElasticStorage.ElasticStorage>(_connection, storageOptions);

            mySqlStorageMock
            .Setup(m => m.QueueProviders)
            .Returns(new PersistentJobQueueProviderCollection(defaultProviderMock.Object));

            _storage = mySqlStorageMock.Object;
            _sut     = new MySqlMonitoringApi(_storage, storageOptions);
        }
Example #3
0
 public MySqlJobQueueMonitoringApi(ElasticStorage.ElasticStorage storage, MySqlStorageOptions storageOptions)
 {
     if (storage == null)
     {
         throw new ArgumentNullException("storage");
     }
     _storage        = storage;
     _storageOptions = storageOptions;
 }
Example #4
0
        public void Ctor_CanCreateSqlServerStorage_WithExistingConnection()
        {
            using (var connection = ConnectionUtils.CreateConnection())
            {
                var storage = new ElasticStorage.ElasticStorage(connection, _options);

                Assert.NotNull(storage);
            }
        }
 public MySqlStorageConnection(ElasticStorage.ElasticStorage storage, MySqlStorageOptions storageOptions)
 {
     if (storage == null)
     {
         throw new ArgumentNullException("storage");
     }
     _storage        = storage;
     _storageOptions = storageOptions;
 }
Example #6
0
        private ExpirationManager CreateManager(MySqlConnection connection)
        {
            var options = new MySqlStorageOptions
            {
                JobExpirationCheckInterval = TimeSpan.Zero
            };
            var storage = new ElasticStorage.ElasticStorage(connection, options);

            return(new ExpirationManager(storage, options));
        }
        public MySqlJobQueueMonitoringApiTests()
        {
            _connection = new MySqlConnection(ConnectionUtils.GetConnectionString());
            _connection.Open();

            var storageOptions = new MySqlStorageOptions();

            _storage = new ElasticStorage.ElasticStorage(_connection, storageOptions);
            _sut     = new MySqlJobQueueMonitoringApi(_storage, storageOptions);
        }
        public CountersAggregator(ElasticStorage.ElasticStorage storage, MySqlStorageOptions storageOptions)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }

            _storage        = storage;
            _storageOptions = storageOptions;
        }
 private void UseConnections(Action <MySqlConnection, MySqlStorageConnection> action)
 {
     using (var sqlConnection = ConnectionUtils.CreateConnection())
     {
         var storage = new ElasticStorage.ElasticStorage(sqlConnection, new MySqlStorageOptions());
         using (var connection = new MySqlStorageConnection(storage, new MySqlStorageOptions()))
         {
             action(sqlConnection, connection);
         }
     }
 }
Example #10
0
        public CountersAggregatorTests()
        {
            var options = new MySqlStorageOptions
            {
                CountersAggregateInterval = TimeSpan.Zero
            };

            _connection = ConnectionUtils.CreateConnection();
            _storage    = new ElasticStorage.ElasticStorage(_connection, options);
            _sut        = new CountersAggregator(_storage, options);
        }
        public MySqlJobQueue(ElasticStorage.ElasticStorage storage, MySqlStorageOptions options)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _storage = storage;
            _options = options;
        }
Example #12
0
        public ExpirationManager(ElasticStorage.ElasticStorage storage, MySqlStorageOptions storageOptions)
        {
            _storage        = storage ?? throw new ArgumentNullException("storage");
            _storageOptions = storageOptions ?? throw new ArgumentNullException(nameof(storageOptions));

            _processedTables = new[]
            {
                $"{storageOptions.TablesPrefix}AggregatedCounter",
                $"{storageOptions.TablesPrefix}Job",
                $"{storageOptions.TablesPrefix}List",
                $"{storageOptions.TablesPrefix}Set",
                $"{storageOptions.TablesPrefix}Hash",
            };
        }
        public MySqlJobQueueProvider(ElasticStorage.ElasticStorage storage, MySqlStorageOptions options)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            _jobQueue      = new MySqlJobQueue(storage, options);
            _monitoringApi = new MySqlJobQueueMonitoringApi(storage, options);
        }
 public MySqlDistributedLock(ElasticStorage.ElasticStorage storage, string resource, TimeSpan timeout, MySqlStorageOptions storageOptions)
     : this(storage.CreateAndOpenConnection(), resource, timeout, storageOptions)
 {
     _storage = storage;
 }
Example #15
0
        private MySqlJobQueue CreateJobQueue(MySqlConnection connection)
        {
            var storage = new ElasticStorage.ElasticStorage(connection, _storageOptions);

            return(new MySqlJobQueue(storage, new MySqlStorageOptions()));
        }
Example #16
0
 public MySqlJobQueueTests()
 {
     _connection = ConnectionUtils.CreateConnection();
     _storage    = new ElasticStorage.ElasticStorage(_connection, _storageOptions);
 }