public static void Start() { logger.Info("Conectandose a las bases de datos..."); CreateRepositories(); var cronExpression = ConfigurationManager.AppSettings["scheduleConfig"]; logger.InfoFormat("Configurando servicio con la expresión '{0}'...", cronExpression); _schedulingService = new SchedulingService(); _schedulingService.LogFactory = new LogFactory(); _schedulingService.At(cronExpression).Run(() => { if (!_isRunning) { _isRunning = true; return(new ClientJob( _clientRepository, () => { _isRunning = false; })); } return(new DumClientJob()); }); _schedulingService.Start(); logger.Info("Servicio corriendo..."); }
private static void ServiceSetup(ISchedulingService service) { var crontab = ConfigurationManager.AppSettings["crontab"]; service .At(crontab) .Run<Job>() .Named("mongo"); }
static void ServiceSetup(ISchedulingService service) { service.LogFactory = new NCron.Integration.log4net.LogFactory(); string cron = ConfigurationManager.AppSettings["cron"].ToString(); service.At(cron).Run <MyJob>(); }
/// <summary> /// Creates a new schedule executing once every month. /// </summary> /// <param name="service">The service to which the schedule should be added.</param> /// <returns>A part that allows chained fluent method calls.</returns> public static SchedulePart Monthly(this ISchedulingService service) { return(service.At("42 4 1 * *")); }
/// <summary> /// Creates a new schedule executing once every week. /// </summary> /// <param name="service">The service to which the schedule should be added.</param> /// <returns>A part that allows chained fluent method calls.</returns> public static SchedulePart Weekly(this ISchedulingService service) { return(service.At("22 4 * * 0")); }
/// <summary> /// Creates a new schedule executing once every day. /// </summary> /// <param name="service">The service to which the schedule should be added.</param> /// <returns>A part that allows chained fluent method calls.</returns> public static SchedulePart Daily(this ISchedulingService service) { return(service.At("02 4 * * *")); }
/// <summary> /// Creates a new schedule executing once every hour. /// </summary> /// <param name="service">The service to which the schedule should be added.</param> /// <returns>A part that allows chained fluent method calls.</returns> public static SchedulePart Hourly(this ISchedulingService service) { return(service.At("01 * * * *")); }
/// <summary> /// Creates a new schedule based on a crontab expression (eg: 0 0 * * *). /// Please refer to the project wiki for examples. /// </summary> /// <param name="service">The service to which the schedule should be added.</param> /// <param name="crontab">A crontab expression describing the schedule.</param> /// <returns>A part that allows chained fluent method calls.</returns> public static SchedulePart At(this ISchedulingService service, string crontab) { var schedule = CrontabSchedule.Parse(crontab); return(service.At(schedule.GetNextOccurrence)); }
static void ServiceSetup(ISchedulingService service) { service.At("*/5 * * * *").Run(() => new ReceiverJob()); service.At("*/5 * * * *").Run(() => new PublisherJob()); }
private static void ServiceSetup(ISchedulingService schedulingService) { var taskCreator = IoC.Resolve<ITaskCreator>(); schedulingService.At("10 * * * *").Run(() => new CreateTaskJob(taskCreator)); }