示例#1
0
 public static RFCatalogKey Create(RFKeyDomain domain, RFEnum triggerName)
 {
     return(domain.Associate(new RFSchedulerTriggerKey
     {
         TriggerName = triggerName,
         StoreType = RFStoreType.Document,
         Plane = RFPlane.Ephemeral
     }));
 }
 public static RFManualTriggerKey CreateKey(RFKeyDomain keyDomain, RFEnum triggerCode, RFGraphInstance instance)
 {
     return(keyDomain.Associate <RFManualTriggerKey>(new RFManualTriggerKey
     {
         StoreType = RFStoreType.Document,
         Plane = RFPlane.User,
         GraphInstance = instance,
         TriggerCode = triggerCode
     }));
 }
示例#3
0
 public static RFGenericCatalogKey Create(RFKeyDomain keyDomain, string path, RFEnum _enum, RFGraphInstance instance)
 {
     return(keyDomain.Associate(new RFGenericCatalogKey
     {
         GraphInstance = instance,
         Name = _enum.ToString(),
         Path = path,
         Plane = RFPlane.User,
         StoreType = RFStoreType.Document
     }));
 }
示例#4
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")
            });
        }
示例#5
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);
        }
        /// <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);
        }