Beispiel #1
0
 private static void ExecuteJob(Action<ISchedulingService> setupHandler, string jobName)
 {
     try
     {
         using (var service = new SchedulingService())
         {
             setupHandler(service);
             service.ExecuteNamedJob(jobName);
         }
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine(ex);
     }
 }
 public ServiceProcessAdapter(SchedulingService service)
 {
     _service = service;
 }
 protected CronJobTestsBase()
 {
     _systemClock = new SystemClock(new DateTime(2012, 1, 1));
     SystemTime.Resolver = () => _systemClock.UtcNow;
     _schedulingService = new SchedulingService();
 }
Beispiel #4
0
 private static void Schedule(SchedulingService schedulingService) {
     schedulingService.At("*/1 * * * *").Run<SeparateProcessCronJob>().Named("out-of-process");
     schedulingService.At("*/1 * * * *").Run(() => new InProcessCronJob());
 }
Beispiel #5
0
 internal JobPart(SchedulingService service, ScheduledJob queueEntry)
 {
     _service = service;
     _queueEntry = queueEntry;
 }
Beispiel #6
0
        private static void RunService(Action<ISchedulingService> setupHandler, bool debug)
        {
            try
            {
                AppDomain.CurrentDomain.UnhandledException +=
                    (o, e) => ExceptionHelper.LogUnhandledException(e.ExceptionObject);

                using (var service = new SchedulingService())
                {
                    setupHandler(service);

                    if (debug)
                    {
                        service.Start();
                        Console.ReadLine();
                        service.Stop();
                    }
                    else
                    {
                        using (var adapter = new ServiceProcessAdapter(service))
                        {
                            ServiceBase.Run(adapter);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHelper.LogUnhandledException(exception);
            }
        }
 public ServiceProcessAdapter(SchedulingService service)
 {
     _service = service;
 }