public static IGlobalConfiguration UsePostgreSqlMetrics(this IGlobalConfiguration configuration) { configuration.UseDashboardMetric(MaxConnections); configuration.UseDashboardMetric(ActiveConnections); configuration.UseDashboardMetric(PostgreSqlServerVersion); return(configuration); }
private void UseSqlServerStorage(IGlobalConfiguration config, string nameOrConnectionString, string[] queues) { var configSql = config .UseDashboardMetric(Hangfire.SqlServer.SqlServerStorage.ActiveConnections) //活动连接数量 .UseDashboardMetric(Hangfire.SqlServer.SqlServerStorage.TotalConnections) //总连接数量 .UseSqlServerStorage(nameOrConnectionString, new Hangfire.SqlServer.SqlServerStorageOptions { QueuePollInterval = TimeSpan.FromSeconds(1) }) ; try { //var msmq = System.Messaging.MessageQueue.GetMachineId(Environment.MachineName); //configSql.UseMsmqQueues(@".\Private$\hangfire{0}", queues); } catch (Exception /*ex*/) { //try //{ // configSql.Entry.UseRabbitMq(f => // { // f.Username = ""; // f.Password = ""; // f.HostName = ""; // f.VirtualHost = ""; // //f.Port = 0; // //f.Uri = new Uri(""); // }, queues); //} //catch (Exception ex2) { } } }
private void UseSqlServerStorage(IGlobalConfiguration config, string nameOrConnectionString, string[] queues) { var configSql = config .UseDashboardMetric(Hangfire.SqlServer.SqlServerStorage.ActiveConnections) //活动连接数量 .UseDashboardMetric(Hangfire.SqlServer.SqlServerStorage.TotalConnections) //总连接数量 .UseSqlServerStorage(nameOrConnectionString, new Hangfire.SqlServer.SqlServerStorageOptions { //QueuePollInterval = TimeSpan.FromSeconds(1), CommandBatchMaxTimeout = TimeSpan.FromMinutes(5), SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5), QueuePollInterval = TimeSpan.Zero, UseRecommendedIsolationLevel = true, UsePageLocksOnDequeue = true, DisableGlobalLocks = true //, //EnableHeavyMigrations = true }) ; try { //var msmq = System.Messaging.MessageQueue.GetMachineId(Environment.MachineName); //configSql.UseMsmqQueues(@".\Private$\hangfire{0}", queues); } catch (Exception /*ex*/) { //try //{ // configSql.Entry.UseRabbitMq(f => // { // f.Username = ""; // f.Password = ""; // f.HostName = ""; // f.VirtualHost = ""; // //f.Port = 0; // //f.Uri = new Uri(""); // }, queues); //} //catch (Exception ex2) { } } }