Advertisement
Guest User

Untitled

a guest
May 31st, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. protected void Application_Start()
  2. {
  3. ...
  4. ControllerBuilder.Current.SetControllerFactory(new PnAwebAppControllerFactory());
  5. BootStrapper.ConfigureDependencies();
  6. GlobalConfig.CustomizeConfig(GlobalConfiguration.Configuration);
  7.  
  8. GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
  9. GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);
  10.  
  11. ConfigureQuartzJobs();
  12. }
  13.  
  14. public static void ConfigureQuartzJobs()
  15. {
  16. // construct a scheduler factory
  17. var schedFact = new StdSchedulerFactory();
  18.  
  19. // get a scheduler
  20. var sched = schedFact.GetScheduler();
  21. sched.Start();
  22.  
  23. // Create job for emails in que for all companies
  24. var jobEmailsQued = JobBuilder.Create<EmailQueJob>().WithIdentity("EmailQueJob", "group1").Build();
  25.  
  26. // Create trigger for jobEmailsQued
  27. var triggerJobEmailsQued =
  28. TriggerBuilder.Create()
  29. .WithIdentity("TriggerEmailQueJob", "group1")
  30. .WithSchedule(CronScheduleBuilder.CronSchedule("0 0/2 * * * ?"))
  31. .ForJob(jobEmailsQued)
  32. .Build();
  33.  
  34. // Schedule jobEmailsQued
  35. sched.ScheduleJob(jobEmailsQued, triggerJobEmailsQued);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement