Exemplo n.º 1
0
        /// <summary>
        /// Configures process to automatically run based on configuration
        /// </summary>
        /// <param name="taskName"></param>
        /// <param name="process"></param>
        /// <param name="isExclusive">If set the task won't run concurrently</param>
        /// <param name="isSystem"></param>
        /// <returns></returns>
        public RFEngineTaskDefinition AddScheduledTask(string taskName, RFEngineProcessDefinition process, bool isSystem = false)
        {
            var task = new RFSchedulerTaskDefinition
            {
                RangeFunc     = c => RFSchedulerRange.ReadFromConfig(RFSchedulerTaskDefinition.CONFIG_SECTION, taskName, c.UserConfig),
                SchedulesFunc = c => RFSchedulerSchedule.ReadFromConfig(RFSchedulerTaskDefinition.CONFIG_SECTION, taskName, c.UserConfig).Single(),
                TaskName      = taskName,
                TaskProcess   = process,
                IsSystem      = isSystem
            };

            Tasks.Add(task);
            task.AddToEngine(this);
            return(task);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Configures process to automatically run on specific schedule
        /// </summary>
        /// <param name="taskName"></param>
        /// <param name="schedules"></param>
        /// <param name="range"></param>
        /// <param name="process"></param>
        /// <returns></returns>
        public RFEngineTaskDefinition AddScheduledTask(string taskName, Func <List <RFSchedulerSchedule> > schedulesFunc, Func <RFSchedulerRange> rangeFunc, RFEngineProcessDefinition process, bool isSystem)
        {
            var task = new RFSchedulerTaskDefinition
            {
                RangeFunc     = _ => rangeFunc(),
                SchedulesFunc = _ => schedulesFunc(),
                TaskName      = taskName,
                TaskProcess   = process,
                IsSystem      = isSystem
            };

            Tasks.Add(task);
            task.AddToEngine(this);
            return(task);
        }