Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="storageOptions"></param>
 public LiteDbJobQueue(HangfireDbContext connection, LiteDbStorageOptions storageOptions)
 {
     _storageOptions = storageOptions ?? throw new ArgumentNullException(nameof(storageOptions));
     _connection     = connection ?? throw new ArgumentNullException(nameof(connection));
 }
 /// <summary>
 /// Opens connection to database
 /// </summary>
 /// <returns>Database context</returns>
 public HangfireDbContext CreateAndOpenConnection()
 {
     return(_connectionString != null
         ? HangfireDbContext.Instance(_connectionString, _storageOptions.Prefix)
         : null);
 }
        /// <summary>
        /// Ctor using default storage options
        /// </summary>
        public LiteDbConnection(HangfireDbContext database, PersistentJobQueueProviderCollection queueProviders)

            : this(database, new LiteDbStorageOptions(), queueProviders)
        {
        }
Exemple #4
0
 /// <summary>
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="queueProviders"></param>
 /// <exception cref="ArgumentNullException"></exception>
 public LiteDbWriteOnlyTransaction(HangfireDbContext connection,
                                   PersistentJobQueueProviderCollection queueProviders)
 {
     _connection     = connection ?? throw new ArgumentNullException(nameof(connection));
     _queueProviders = queueProviders ?? throw new ArgumentNullException(nameof(queueProviders));
 }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connection"></param>
 public LiteDbJobQueueMonitoringApi(HangfireDbContext connection)
 {
     _connection = connection ?? throw new ArgumentNullException(nameof(connection));
 }
Exemple #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connection"></param>
 /// <returns></returns>
 public IPersistentJobQueueMonitoringApi GetJobQueueMonitoringApi(HangfireDbContext connection)
 {
     return(new LiteDbJobQueueMonitoringApi(connection));
 }
Exemple #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connection"></param>
 /// <returns></returns>
 public IPersistentJobQueue GetJobQueue(HangfireDbContext connection)
 {
     return(new LiteDbJobQueue(connection, _storageOptions));
 }
Exemple #8
0
        private long GetNumberOfJobsByStateName(HangfireDbContext connection, string stateName)
        {
            var count = connection.Job.Count(_ => _.StateName == stateName);

            return(count);
        }
Exemple #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="database"></param>
 /// <param name="queueProviders"></param>
 public LiteDbMonitoringApi(HangfireDbContext database, PersistentJobQueueProviderCollection queueProviders)
 {
     _database       = database;
     _queueProviders = queueProviders;
 }
Exemple #10
0
        private long GetNumberOfJobsByStateName(HangfireDbContext connection, string stateName)
        {
            var count = connection.Job.Count(Query.EQ("StateName", stateName));

            return(count);
        }