コード例 #1
0
        public override void AddToEngine(RFEngineDefinition engine)
        {
            var triggerName = RFEnum.FromString(TaskName);
            var triggerKey  = RFSchedulerTriggerKey.Create(engine.KeyDomain, triggerName);

            engine.AddCatalogUpdateTrigger <RFSchedulerTriggerKey>(k => k.TriggerName.Equals(triggerName), TaskProcess);

            engine.Schedules.Add(c => new RFSchedulerConfig
            {
                Range      = RangeFunc(c),
                Schedules  = SchedulesFunc(c),
                TriggerKey = triggerKey,
                IsEnabled  = c.UserConfig.GetBool(CONFIG_SECTION, TaskName, false, true, "Is Enabled")
            });
        }
コード例 #2
0
        public override void AddToEngine(RFEngineDefinition engine)
        {
            var triggerName = RFEnum.FromString(TaskName);
            var triggerKey  = RFSchedulerTriggerKey.Create(engine.KeyDomain, triggerName);

            var scheduler = engine.AddProcess(
                processName: String.Format("Task {0} Scheduler", TaskName),
                description: string.Format("Schedules task {0}", TaskName),
                processor: () => new RFSchedulerProcessor(new RFSchedulerConfig
            {
                Range      = RangeFunc(),
                Schedules  = SchedulesFunc(),
                TriggerKey = triggerKey
            }));

            engine.AddIntervalTrigger(scheduler);
            engine.AddCatalogUpdateTrigger <RFSchedulerTriggerKey>(k => k.TriggerName.Equals(triggerName), TaskProcess);
        }
コード例 #3
0
        /// <summary>
        /// Configures graph process to automatically trigger on specific schedule
        /// </summary>
        /// <returns></returns>
        public RFGraphTaskDefinition AddScheduledTask <D>(string taskName, Func <List <RFSchedulerSchedule> > schedulesFunc, Func <RFSchedulerRange> rangeFunc, RFGraphProcessDefinition process, RFGraphInstance instance)
            where D : RFGraphProcessorDomain
        {
            var triggerName = RFEnum.FromString(taskName);
            var triggerKey  = RFManualTriggerKey.CreateKey(EngineConfig.KeyDomain, triggerName, instance);

            // map to process' input
            process.MapInput <D>(d => d.Trigger, triggerKey);

            var task = new RFScheduledGraphTaskDefinition
            {
                RangeFunc     = rangeFunc,
                SchedulesFunc = schedulesFunc,
                TaskName      = taskName,
                GraphProcess  = process,
                TriggerKey    = triggerKey
            };

            GraphTasks.Add(task);

            task.AddToEngine(EngineConfig);

            return(task);
        }