Exemple #1
0
        public async Task ResumeAll(ScheduleActionGroup group)
        {
            if (_scheduleStatus == 2)
            {
                await _scheduler.ResumeAll();

                _scheduleStatus = 1;
            }
        }
Exemple #2
0
        public async Task Shutdown(ScheduleActionGroup group)
        {
            if (_scheduleStatus == 1)
            {
                foreach (var item in _actions)
                {
                    await MainJob.Shutdown(item.Name);
                }

                await _scheduler.Shutdown();

                _scheduleStatus = 0;
            }
        }
Exemple #3
0
        public async Task Pause(ScheduleActionGroup group)
        {
            if (_scheduleStatus == 1)
            {
                foreach (var item in _actions)
                {
                    await MainJob.Pause(item.Name);
                }

                await _scheduler.PauseAll();

                _scheduleStatus = 2;
            }
        }
Exemple #4
0
        public async Task Start(ScheduleActionGroup group)
        {
            if (_scheduleStatus == 0)
            {
                var props = new NameValueCollection();
                props["quartz.serializer.type"] = "binary";

                StdSchedulerFactory factory = new StdSchedulerFactory(props);
                _scheduler = await factory.GetScheduler();

                MainJob.ScheduleActionRepository = _scheduleActionRepositoryCacheProxy;
                MainJob.ScheduleActionInitGeneratorServiceFactories = ScheduleActionInitGeneratorServiceFactories;
                MainJob.ErrorCategory       = _errorCategory;
                MainJob.InformationCategory = _informationCategory;

                _actions = new List <ScheduleAction>();

                await GetAllAction(group, 1, async (action) =>
                {
                    _actions.Add(action);

                    IJobDetail job = JobBuilder.Create <MainJob>()
                                     .WithIdentity(action.Name, group.Name)
                                     .UsingJobData("InitType", group.ExecuteActionInitType)
                                     .UsingJobData("InitConfiguration", group.ExecuteActionInitConfiguration)
                                     .UsingJobData("ActionName", action.Name)
                                     .UsingJobData("GroupName", group.Name)
                                     .Build();

                    ITrigger trigger = TriggerBuilder.Create()
                                       .WithIdentity(action.Name, group.Name)
                                       .StartNow()
                                       .WithCronSchedule(action.TriggerCondition)
                                       .Build();
                    await _scheduler.ScheduleJob(job, trigger);
                });

                await _scheduler.Start();

                _scheduleStatus = 1;
            }
        }
Exemple #5
0
 public async Task Update(ScheduleActionGroup group)
 {
     await _scheduleActionGroupStore.Update(group);
 }
Exemple #6
0
 public Task RemoveAction(ScheduleActionGroup group, Guid actionId)
 {
     throw new NotImplementedException();
 }
Exemple #7
0
 public async Task <QueryResult <ScheduleAction> > GetAction(ScheduleActionGroup group, int page, int pageSize)
 {
     return(await _scheduleActionStore.QueryByPageGroup(group.ID, page, pageSize));
 }
Exemple #8
0
 public async Task GetAllAction(ScheduleActionGroup group, int status, Func <ScheduleAction, Task> callback)
 {
     await _scheduleActionStore.QueryAllAction(group.ID, status, callback);
 }
Exemple #9
0
 public async Task Delete(ScheduleActionGroup group)
 {
     await _scheduleActionStore.Delete(group.ID);
 }
Exemple #10
0
 public async Task AddAction(ScheduleActionGroup group, Guid actionId)
 {
     await _scheduleActionStore.AddActionGroupRelation(actionId, group.ID);
 }
Exemple #11
0
 public async Task Add(ScheduleActionGroup group)
 {
     await _scheduleActionGroupStore.Add(group);
 }