Guest User

Untitled

a guest
Feb 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. //Usage (with container):
  2.  
  3. var container = new WindsorContainer();
  4. container.Register(Component.For<TestJob>(), Component.For<TestJob2>());
  5.  
  6. ISchedulerFactory factory = new DefaultSchedulerFactory();
  7. var scheduler = factory
  8. .UseContainer(() => new WindsorServiceLocator(container))
  9. .Create();
  10.  
  11. scheduler.Setup(
  12. Job.Run<TestJob>(x => x.RunJob()).Every(1.Second()),
  13. Job.Run<TestJob2>(x => x.RunJob()).Every(10.Seconds())
  14. ).Start();
  15.  
  16.  
  17. //Usage (without container, providing instance):
  18.  
  19. var testJob = new TestJob2();
  20. var scheduler = new DefaultSchedulerFactory().Create();
  21.  
  22. scheduler.Setup(
  23. Job.Run(testJob.RunJob).Every(10.Minutes())
  24. ).Start();
  25.  
  26.  
  27. //Usage (without container, letting Khronos create instance):
  28.  
  29. var scheduler = new DefaultSchedulerFactory().Create();
  30.  
  31. scheduler.Setup(
  32. Job.Run<TestJob>(x => x.RunJob()).Every(2.Hours())
  33. ).Start();
Add Comment
Please, Sign In to add comment