Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Application_Start()
- {
- ...
- ControllerBuilder.Current.SetControllerFactory(new PnAwebAppControllerFactory());
- BootStrapper.ConfigureDependencies();
- GlobalConfig.CustomizeConfig(GlobalConfiguration.Configuration);
- GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
- GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);
- ConfigureQuartzJobs();
- }
- public static void ConfigureQuartzJobs()
- {
- // construct a scheduler factory
- var schedFact = new StdSchedulerFactory();
- // get a scheduler
- var sched = schedFact.GetScheduler();
- sched.Start();
- // Create job for emails in que for all companies
- var jobEmailsQued = JobBuilder.Create<EmailQueJob>().WithIdentity("EmailQueJob", "group1").Build();
- // Create trigger for jobEmailsQued
- var triggerJobEmailsQued =
- TriggerBuilder.Create()
- .WithIdentity("TriggerEmailQueJob", "group1")
- .WithSchedule(CronScheduleBuilder.CronSchedule("0 0/2 * * * ?"))
- .ForJob(jobEmailsQued)
- .Build();
- // Schedule jobEmailsQued
- sched.ScheduleJob(jobEmailsQued, triggerJobEmailsQued);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement