public SqlServerDistributedLock([NotNull] SqlServerStorage storage, [NotNull] string resource, TimeSpan timeout) { if (storage == null) throw new ArgumentNullException(nameof(storage)); if (String.IsNullOrEmpty(resource)) throw new ArgumentNullException(nameof(resource)); if (timeout.TotalSeconds + CommandTimeoutAdditionSeconds > Int32.MaxValue) throw new ArgumentException( $"The timeout specified is too large. Please supply a timeout equal to or less than {Int32.MaxValue - CommandTimeoutAdditionSeconds} seconds", nameof(timeout)); _storage = storage; _resource = resource; _connection = storage.CreateAndOpenConnection(); if (!AcquiredLocks.Value.ContainsKey(_resource) || AcquiredLocks.Value[_resource] == 0) { Acquire(_connection, _resource, timeout); if (!_storage.IsExistingConnection(_connection)) { _timer = new Timer(ExecuteKeepAliveQuery, null, KeepAliveInterval, KeepAliveInterval); } AcquiredLocks.Value[_resource] = 1; } else { AcquiredLocks.Value[_resource]++; } }
public void ConfigurationJob(IAppBuilder app) { var options = new BackgroundJobServerOptions { ServerName = String.Format( "{0}.{1}", CommonHelper.GetApplicationName, Environment.MachineName ) }; var jobStorage = new SqlServerStorage(CommonHelper.GetJobConnectionString); // var server = new BackgroundJobServer(options, jobStorage); app.UseHangfire(config => { config.UseSqlServerStorage(CommonHelper.GetJobConnectionString); //var server = new BackgroundJobServer(options); config.UseServer(options); if (CommonHelper.EnableRemoteHangfire) config.UseAuthorizationFilters(new HangFireRestrictiveAuthorizationFilter()); }); // BackgroundJob.Enqueue(() => Debug.WriteLine("Hello, world!")); }
public CountersAggregator(SqlServerStorage storage, TimeSpan interval) { if (storage == null) throw new ArgumentNullException(nameof(storage)); _storage = storage; _interval = interval; }
public SqlServerFetchedJob( [NotNull] SqlServerStorage storage, [NotNull] IDbConnection connection, [NotNull] IDbTransaction transaction, string jobId, string queue) { if (storage == null) throw new ArgumentNullException(nameof(storage)); if (connection == null) throw new ArgumentNullException(nameof(connection)); if (transaction == null) throw new ArgumentNullException(nameof(transaction)); if (jobId == null) throw new ArgumentNullException(nameof(jobId)); if (queue == null) throw new ArgumentNullException(nameof(queue)); _storage = storage; _connection = connection; _transaction = transaction; JobId = jobId; Queue = queue; if (!_storage.IsExistingConnection(_connection)) { _timer = new Timer(ExecuteKeepAliveQuery, null, KeepAliveInterval, KeepAliveInterval); } }
private static string GetAggregationQuery(SqlServerStorage storage) { return $@"DECLARE @RecordsToAggregate TABLE ( [Key] NVARCHAR(100) NOT NULL, [Value] SMALLINT NOT NULL, [ExpireAt] DATETIME NULL ) SET TRANSACTION ISOLATION LEVEL READ COMMITTED BEGIN TRAN DELETE TOP (@count) C OUTPUT DELETED.[Key], DELETED.[Value], DELETED.[ExpireAt] INTO @RecordsToAggregate FROM [{storage.SchemaName}].[Counter] C WITH (READPAST, XLOCK, INDEX(0)) SET NOCOUNT ON ;MERGE [{storage.SchemaName}].[AggregatedCounter] WITH (HOLDLOCK) AS [Target] USING ( SELECT [Key], SUM([Value]) as [Value], MAX([ExpireAt]) AS [ExpireAt] FROM @RecordsToAggregate GROUP BY [Key]) AS [Source] ([Key], [Value], [ExpireAt]) ON [Target].[Key] = [Source].[Key] WHEN MATCHED THEN UPDATE SET [Target].[Value] = [Target].[Value] + [Source].[Value], [Target].[ExpireAt] = (SELECT MAX([ExpireAt]) FROM (VALUES ([Source].ExpireAt), ([Target].[ExpireAt])) AS MaxExpireAt([ExpireAt])) WHEN NOT MATCHED THEN INSERT ([Key], [Value], [ExpireAt]) VALUES ([Source].[Key], [Source].[Value], [Source].[ExpireAt]); COMMIT TRAN"; }
public ExpirationManager(SqlServerStorage storage, TimeSpan checkInterval) { if (storage == null) throw new ArgumentNullException("storage"); _storage = storage; _checkInterval = checkInterval; }
public SqlServerJobQueue([NotNull] SqlServerStorage storage, SqlServerStorageOptions options) { if (storage == null) throw new ArgumentNullException("storage"); if (options == null) throw new ArgumentNullException("options"); _storage = storage; _options = options; }
public static SqlServerStorage UseSqlServerStorage( this IBootstrapperConfiguration configuration, string nameOrConnectionString) { var storage = new SqlServerStorage(nameOrConnectionString); configuration.UseStorage(storage); return storage; }
public SqlServerWriteOnlyTransaction([NotNull] SqlServerStorage storage, Func <DbConnection> dedicatedConnectionFunc) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } _storage = storage; _dedicatedConnectionFunc = dedicatedConnectionFunc; }
public static IGlobalConfiguration<SqlServerStorage> UseSqlServerStorage( [NotNull] this IGlobalConfiguration configuration, [NotNull] string nameOrConnectionString) { if (configuration == null) throw new ArgumentNullException(nameof(configuration)); if (nameOrConnectionString == null) throw new ArgumentNullException(nameof(nameOrConnectionString)); var storage = new SqlServerStorage(nameOrConnectionString); return configuration.UseStorage(storage); }
public CountersAggregator(SqlServerStorage storage, TimeSpan interval) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } _storage = storage; _interval = interval; }
public ExpirationManager(SqlServerStorage storage, TimeSpan checkInterval) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } _storage = storage; _checkInterval = checkInterval; }
public static SqlServerStorage UseSqlServerStorage( this IBootstrapperConfiguration configuration, string nameOrConnectionString) { var storage = new SqlServerStorage(nameOrConnectionString); configuration.UseStorage(storage); return(storage); }
public SqlServerMonitoringApi([NotNull] SqlServerStorage storage, int?jobListLimit) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } _storage = storage; _jobListLimit = jobListLimit; }
public void Configuration(IAppBuilder app) { // GlobalConfiguration.UseStorage isn't necessary here, // because you are passing a storage instance explicitly. var storage1 = new SqlServerStorage(@"connection_string_1"); var storage2 = new SqlServerStorage(@"connection_string_2"); app.UseHangfireDashboard("/hangfire1", new DashboardOptions(), storage1); app.UseHangfireDashboard("/hangfire2", new DashboardOptions(), storage2); }
public static IGlobalConfiguration<SqlServerStorage> UseSqlServerStorage( [NotNull] this IGlobalConfiguration configuration, [NotNull] string nameOrConnectionString, [NotNull] SqlServerStorageOptions options) { if (configuration == null) throw new ArgumentNullException("configuration"); if (nameOrConnectionString == null) throw new ArgumentNullException("nameOrConnectionString"); if (options == null) throw new ArgumentNullException("options"); var storage = new SqlServerStorage(nameOrConnectionString, options); return configuration.UseStorage(storage); }
public SqlServerJobQueueProvider([NotNull] SqlServerStorage storage, [NotNull] SqlServerStorageOptions options) { if (storage == null) { throw new ArgumentNullException("storage"); } if (options == null) { throw new ArgumentNullException("options"); } _jobQueue = new SqlServerJobQueue(storage, options); _monitoringApi = new SqlServerJobQueueMonitoringApi(storage); }
public SqlServerDistributedLock([NotNull] SqlServerStorage storage, [NotNull] string resource, TimeSpan timeout) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } if (String.IsNullOrEmpty(resource)) { throw new ArgumentNullException(nameof(resource)); } if (timeout.TotalSeconds + CommandTimeoutAdditionSeconds > Int32.MaxValue) { throw new ArgumentException( $"The timeout specified is too large. Please supply a timeout equal to or less than {Int32.MaxValue - CommandTimeoutAdditionSeconds} seconds", nameof(timeout)); } if (timeout.TotalMilliseconds > Int32.MaxValue) { throw new ArgumentException( $"The timeout specified is too large. Please supply a timeout equal to or less than {(int)TimeSpan.FromMilliseconds(Int32.MaxValue).TotalSeconds} seconds", nameof(timeout)); } _storage = storage; _resource = resource; if (!AcquiredLocks.Value.ContainsKey(_resource) || AcquiredLocks.Value[_resource] == 0) { _connection = storage.CreateAndOpenConnection(); try { Acquire(_connection, _resource, timeout); } catch (Exception) { storage.ReleaseConnection(_connection); throw; } if (!_storage.IsExistingConnection(_connection)) { _timer = new Timer(ExecuteKeepAliveQuery, null, KeepAliveInterval, KeepAliveInterval); } AcquiredLocks.Value[_resource] = 1; } else { AcquiredLocks.Value[_resource]++; } }
public SqlServerJobQueue([NotNull] SqlServerStorage storage, SqlServerStorageOptions options) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } _storage = storage; _options = options; }
static void Main(string[] args) { GlobalConfiguration.Configuration .UseSqlServerStorage(theConnection); var jobStorage = new Hangfire.SqlServer.SqlServerStorage(theConnection, new Hangfire.SqlServer.SqlServerStorageOptions { PrepareSchemaIfNecessary = false }); //GlobalConfiguration.Configuration.UseAutofacActivator(provider); RecurringJobManager manager = new RecurringJobManager(jobStorage); List <scheduledReports> theReports = GetReports(); //*********Code to clear out jobs if needed*********// using (var connection = jobStorage.GetConnection()) { foreach (var recurringJob in StorageConnectionExtensions.GetRecurringJobs(connection)) { RecurringJob.RemoveIfExists(recurringJob.Id); } } int jobid = 0; foreach (scheduledReports sr in theReports) { RecurringJob.AddOrUpdate("reportjob_" + jobid.ToString(), () => sendReport(sr.apiCalls, sr.description, sr.emailRecipients), sr.cron); jobid++; } //foreach (scheduledReports sr in theReports) //{ // sendReport(sr.apiCalls, sr.description, sr.emailRecipients).Wait(); //} GlobalConfiguration.Configuration.UseSqlServerStorage(theConnection); using (var server = new BackgroundJobServer()) { Console.WriteLine("Hangfire Server started. Press any key to exit..."); Console.ReadKey(); } }
public SqlServerFetchedJob( [NotNull] SqlServerStorage storage, [NotNull] IDbConnection connection, [NotNull] IDbTransaction transaction, string jobId, string queue) { if (storage == null) throw new ArgumentNullException("storage"); if (connection == null) throw new ArgumentNullException("connection"); if (transaction == null) throw new ArgumentNullException("transaction"); if (jobId == null) throw new ArgumentNullException("jobId"); if (queue == null) throw new ArgumentNullException("queue"); _storage = storage; _connection = connection; _transaction = transaction; JobId = jobId; Queue = queue; }
public SqlServerDistributedLock([NotNull] SqlServerStorage storage, [NotNull] string resource, TimeSpan timeout) { if (storage == null) throw new ArgumentNullException("storage"); if (String.IsNullOrEmpty(resource)) throw new ArgumentNullException("resource"); if ((timeout.TotalSeconds + CommandTimeoutAdditionSeconds) > Int32.MaxValue) throw new ArgumentException(string.Format("The timeout specified is too large. Please supply a timeout equal to or less than {0} seconds", Int32.MaxValue - CommandTimeoutAdditionSeconds), "timeout"); _storage = storage; _resource = resource; _connection = storage.CreateAndOpenConnection(); if (!AcquiredLocks.Value.ContainsKey(_resource) || AcquiredLocks.Value[_resource] == 0) { Acquire(_connection, _resource, timeout); AcquiredLocks.Value[_resource] = 1; } else { AcquiredLocks.Value[_resource]++; } }
private JobStorage CreateJobStorage(Stage stage) { JobStorage result = null; if (string.Equals(_options.JobStorageType, "SqlServer", StringComparison.OrdinalIgnoreCase)) { var sqlServerStorageOptions = new SqlServerStorageOptions { PrepareSchemaIfNecessary = stage == Stage.ConfigureDatabase, QueuePollInterval = TimeSpan.FromSeconds(60) /* Default is 15 seconds */ }; result = new SqlServerStorage(_options.DatabaseConnectionStringName, sqlServerStorageOptions); } else if (string.Equals(_options.JobStorageType, "Memory", StringComparison.OrdinalIgnoreCase)) { result = new MemoryStorage(); } return result; }
public SqlServerFetchedJob( [NotNull] SqlServerStorage storage, [NotNull] IDbConnection connection, [NotNull] IDbTransaction transaction, string jobId, string queue) { if (storage == null) { throw new ArgumentNullException("storage"); } if (connection == null) { throw new ArgumentNullException("connection"); } if (transaction == null) { throw new ArgumentNullException("transaction"); } if (jobId == null) { throw new ArgumentNullException("jobId"); } if (queue == null) { throw new ArgumentNullException("queue"); } _storage = storage; _connection = connection; _transaction = transaction; JobId = jobId; Queue = queue; if (!_storage.IsExistingConnection(_connection)) { _timer = new Timer(ExecuteKeepAliveQuery, null, TimeSpan.Zero, KeepAliveInterval); } }
public SqlServerDistributedLock([NotNull] SqlServerStorage storage, [NotNull] string resource, TimeSpan timeout) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } if (String.IsNullOrEmpty(resource)) { throw new ArgumentNullException(nameof(resource)); } _storage = storage; _resource = resource; if (!AcquiredLocks.Value.ContainsKey(_resource) || AcquiredLocks.Value[_resource] == 0) { _connection = storage.CreateAndOpenConnection(); try { Acquire(_connection, _resource, timeout); } catch (Exception) { storage.ReleaseConnection(_connection); throw; } if (!_storage.IsExistingConnection(_connection)) { _timer = new Timer(ExecuteKeepAliveQuery, null, KeepAliveInterval, KeepAliveInterval); } AcquiredLocks.Value[_resource] = 1; } else { AcquiredLocks.Value[_resource]++; } }
static void Main(string[] args) { XmlConfigurator.Configure(); //only once _log.Debug("Application is starting"); if (args.Length > 0) { _storage = new SqlServerStorage(@"Data Source=.;Initial Catalog=SpriteHangFire;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False"); var options = new BackgroundJobServerOptions(); var server = new BackgroundJobServer(options, _storage); server.Start(); Console.WriteLine("Hangfire Server started. Press any key to exit..."); var input = Console.ReadKey(); HandleInput(input); //using () //{ // server.Start(); } else { _log.Info("application launched without arguments"); throw new NullReferenceException("kkkkkkjkljfkldsjfkl"); //FileInfo f = new FileInfo(); File.Create(string.Format(@"C:\TFSDATA\KissTheFuture\Trunk\shopping.lacage.be\shoppingconsole.lacage.be\bin\Debug\{0}.txt", Guid.NewGuid())); Thread.Sleep(5000); } //c.Schedule(() => MyJob.DoSomething(), TimeSpan.FromMinutes(10)); //Console.ReadKey(); //} }
public SqlServerTimeoutJob( [NotNull] SqlServerStorage storage, long id, [NotNull] string jobId, [NotNull] string queue, [NotNull] DateTime?fetchedAt) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } if (jobId == null) { throw new ArgumentNullException(nameof(jobId)); } if (queue == null) { throw new ArgumentNullException(nameof(queue)); } if (fetchedAt == null) { throw new ArgumentNullException(nameof(fetchedAt)); } _storage = storage; Id = id; JobId = jobId; Queue = queue; FetchedAt = fetchedAt.Value; if (storage.SlidingInvisibilityTimeout.HasValue) { _lastHeartbeat = TimestampHelper.GetTimestamp(); _interval = TimeSpan.FromSeconds(storage.SlidingInvisibilityTimeout.Value.TotalSeconds / 5); storage.HeartbeatProcess.Track(this); } }
public SqlServerTimeoutJob( [NotNull] SqlServerStorage storage, long id, [NotNull] string jobId, [NotNull] string queue, [NotNull] DateTime?fetchedAt) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } if (jobId == null) { throw new ArgumentNullException(nameof(jobId)); } if (queue == null) { throw new ArgumentNullException(nameof(queue)); } if (fetchedAt == null) { throw new ArgumentNullException(nameof(fetchedAt)); } _storage = storage; Id = id; JobId = jobId; Queue = queue; FetchedAt = fetchedAt.Value; if (storage.SlidingInvisibilityTimeout.HasValue) { var keepAliveInterval = TimeSpan.FromSeconds(storage.SlidingInvisibilityTimeout.Value.TotalSeconds / 5); _timer = new Timer(ExecuteKeepAliveQuery, null, keepAliveInterval, keepAliveInterval); } }
static void Main() { // log4net.Config.XmlConfigurator.Configure();00000000 logger = NLog.LogManager.GetCurrentClassLogger(); logger.Info("Worker Host process has been started"); unityContainer = UnityConfig.Register(); UnityConfig.ConfigureDefaults(unityContainer); var storage = new SqlServerStorage("HangfireStorageDbContext"); var options = new BackgroundJobServerOptions() { WorkerCount = 10 }; UnityJobActivator unityJobActivator = new UnityJobActivator(unityContainer); GlobalConfiguration.Configuration.UseActivator(unityJobActivator); JobActivator.Current = unityJobActivator; GlobalJobFilters.Filters.Add(new ChildContainerPerJobFilterAttribute(unityJobActivator)); var server = new BackgroundJobServer(options, storage); server.Start(); Thread.Sleep(300000); server.Stop(); }
private static string GetAggregationQuery(SqlServerStorage storage) { // Starting from SQL Server 2014 it's possible to get a query with // much lower cost by adding a clustered index on [Key] column. // However extended support for SQL Server 2012 SP4 ends only on // July 12, 2022. return ($@"DECLARE @RecordsToAggregate TABLE ( [Key] NVARCHAR(100) COLLATE DATABASE_DEFAULT NOT NULL, [Value] INT NOT NULL, [ExpireAt] DATETIME NULL ) SET XACT_ABORT ON SET TRANSACTION ISOLATION LEVEL READ COMMITTED SET DEADLOCK_PRIORITY LOW BEGIN TRAN DELETE TOP (@count) C OUTPUT DELETED.[Key], DELETED.[Value], DELETED.[ExpireAt] INTO @RecordsToAggregate FROM [{storage.SchemaName}].[Counter] C WITH (READPAST, XLOCK, INDEX(0)) SET NOCOUNT ON ;MERGE [{storage.SchemaName}].[AggregatedCounter] WITH (FORCESEEK, HOLDLOCK) AS [Target] USING ( SELECT [Key], SUM([Value]) as [Value], MAX([ExpireAt]) AS [ExpireAt] FROM @RecordsToAggregate GROUP BY [Key]) AS [Source] ([Key], [Value], [ExpireAt]) ON [Target].[Key] COLLATE DATABASE_DEFAULT = [Source].[Key] COLLATE DATABASE_DEFAULT WHEN MATCHED THEN UPDATE SET [Target].[Value] = [Target].[Value] + [Source].[Value], [Target].[ExpireAt] = (SELECT MAX([ExpireAt]) FROM (VALUES ([Source].ExpireAt), ([Target].[ExpireAt])) AS MaxExpireAt([ExpireAt])) WHEN NOT MATCHED THEN INSERT ([Key], [Value], [ExpireAt]) VALUES ([Source].[Key], [Source].[Value], [Source].[ExpireAt]); COMMIT TRAN"); }
public static void Main() { LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter( LogLevel.Info, false, false, true, ""); var sqlServerStorage = new SqlServerStorage( @"Server=.\sqlexpress;Database=Hangfire.Sample;Trusted_Connection=True;"); sqlServerStorage.UseMsmqQueues(@".\Private$\hangfire{0}", "default", "critical"); JobStorage.Current = sqlServerStorage; //new RedisStorage("localhost:6379", 3); RecurringJob.AddOrUpdate(() => Console.WriteLine("Hello, world!"), Cron.Minutely); RecurringJob.AddOrUpdate("hourly", () => Console.WriteLine("Hello"), Cron.Hourly); var options = new BackgroundJobServerOptions { Queues = new[] { "critical", "default" } }; using (var server = new BackgroundJobServer(options)) { var count = 1; while (true) { var command = Console.ReadLine(); if (command == null || command.Equals("stop", StringComparison.OrdinalIgnoreCase)) { break; } if (command.Equals("start", StringComparison.OrdinalIgnoreCase)) { server.Start(); } if (command.StartsWith("add", StringComparison.OrdinalIgnoreCase)) { try { var workCount = int.Parse(command.Substring(4)); for (var i = 0; i < workCount; i++) { var number = i; BackgroundJob.Enqueue<Services>(x => x.Random(number)); } Console.WriteLine("Jobs enqueued."); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (command.StartsWith("static", StringComparison.OrdinalIgnoreCase)) { try { var workCount = int.Parse(command.Substring(7)); for (var i = 0; i < workCount; i++) { BackgroundJob.Enqueue(() => Console.WriteLine("Hello, {0}!", "world")); } Console.WriteLine("Jobs enqueued."); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (command.StartsWith("error", StringComparison.OrdinalIgnoreCase)) { var workCount = int.Parse(command.Substring(6)); for (var i = 0; i < workCount; i++) { BackgroundJob.Enqueue<Services>(x => x.Error()); } } if (command.StartsWith("args", StringComparison.OrdinalIgnoreCase)) { var workCount = int.Parse(command.Substring(5)); for (var i = 0; i < workCount; i++) { BackgroundJob.Enqueue<Services>(x => x.Args(Guid.NewGuid().ToString(), 14442, DateTime.UtcNow)); } } if (command.StartsWith("custom", StringComparison.OrdinalIgnoreCase)) { var workCount = int.Parse(command.Substring(7)); for (var i = 0; i < workCount; i++) { BackgroundJob.Enqueue<Services>(x => x.Custom( new Random().Next(), new []{ "Hello", "world!" }, new Services.CustomObject { Id = 123 }, DayOfWeek.Friday )); } } if (command.StartsWith("fullargs", StringComparison.OrdinalIgnoreCase)) { var workCount = int.Parse(command.Substring(9)); for (var i = 0; i < workCount; i++) { BackgroundJob.Enqueue<Services>(x => x.FullArgs( false, 123, 'c', DayOfWeek.Monday, "hello", new TimeSpan(12, 13, 14), new DateTime(2012, 11, 10), new Services.CustomObject { Id = 123 }, new[] { "1", "2", "3" }, new[] { 4, 5, 6 }, new long[0], null, new List<string> { "7", "8", "9" })); } } if (command.StartsWith("in", StringComparison.OrdinalIgnoreCase)) { var seconds = int.Parse(command.Substring(2)); var number = count++; BackgroundJob.Schedule<Services>(x => x.Random(number), TimeSpan.FromSeconds(seconds)); } if (command.StartsWith("cancelable", StringComparison.OrdinalIgnoreCase)) { var iterations = int.Parse(command.Substring(11)); BackgroundJob.Enqueue<Services>(x => x.Cancelable(iterations, JobCancellationToken.Null)); } if (command.StartsWith("delete", StringComparison.OrdinalIgnoreCase)) { var workCount = int.Parse(command.Substring(7)); for (var i = 0; i < workCount; i++) { var jobId = BackgroundJob.Enqueue<Services>(x => x.EmptyDefault()); BackgroundJob.Delete(jobId); } } if (command.StartsWith("fast", StringComparison.OrdinalIgnoreCase)) { try { var workCount = int.Parse(command.Substring(5)); Parallel.For(0, workCount, i => { if (i % 2 == 0) { BackgroundJob.Enqueue<Services>(x => x.EmptyCritical()); } else { BackgroundJob.Enqueue<Services>(x => x.EmptyDefault()); } }); Console.WriteLine("Jobs enqueued."); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } } Console.WriteLine("Press Enter to exit..."); Console.ReadLine(); }
public MsmqSqlServerStorageExtensionsFacts() { _storage = new SqlServerStorage( @"Server=.\sqlexpress;Database=TheDatabase;Trusted_Connection=True;", new SqlServerStorageOptions { PrepareSchemaIfNecessary = false }); }
public SqlServerConnection([NotNull] SqlServerStorage storage) { if (storage == null) throw new ArgumentNullException(nameof(storage)); _storage = storage; }
public SqlServerWriteOnlyTransaction([NotNull] SqlServerStorage storage) { if (storage == null) throw new ArgumentNullException("storage"); _storage = storage; }
public ExpirationManager(SqlServerStorage storage) : this(storage, TimeSpan.FromHours(1)) { }