| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Threading.Tasks;
- using Microsoft.Owin;
- using Owin;
- using Hangfire;
- using CallCenterApi.Interface.Controllers.His;
- using System.Collections.Generic;
- using Hangfire.Dashboard;
- using Hangfire.Annotations;
- [assembly: OwinStartup(typeof(CallCenterApi.Interface.Startup))]
- namespace CallCenterApi.Interface
- {
- public class Startup
- {
- public void Configuration(IAppBuilder app)
- {
- GlobalConfiguration.Configuration.UseSqlServerStorage("ConnectionString");
- app.UseHangfireDashboard("/hangfire", new DashboardOptions()
- {
- Authorization = new[] { new CustomAuthorizeFilter() }
- });
- app.UseHangfireServer(new BackgroundJobServerOptions()
- {
- Queues = new[] { "updatedata1", "updatedata2", "updatedata3", "updatedata4" }
- });
- RecurringJob.AddOrUpdate<GetController>(a => a.Data1(1), Cron.Hourly, TimeZoneInfo.Local,"updatedata1");
- RecurringJob.AddOrUpdate<GetController>(a => a.Data2(1), Cron.Hourly, TimeZoneInfo.Local, "updatedata2");
- RecurringJob.AddOrUpdate<GetController>(a => a.Data3(1), Cron.Hourly, TimeZoneInfo.Local, "updatedata3");
- RecurringJob.AddOrUpdate<GetController>(a => a.Data4(1), Cron.Hourly, TimeZoneInfo.Local, "updatedata4");
- }
- }
- public class CustomAuthorizeFilter : IDashboardAuthorizationFilter
- {
- public bool Authorize([NotNull] DashboardContext context)
- {
- return true;
- }
- }
- }
|