Exemple #1
0
        protected override void ExecuteCore(FunctionSwitch input, ExecuteResult output)
        {
            if (input.Command == ECommand.Pause)
            {
                var serviceName = input.ServiceType.ServiceType;

                Scheduler.PauseTrigger(serviceName.GetTriggerKey());
                bool yes = Scheduler.IsJobGroupPaused(serviceName + "Trigger");
            }
        }
Exemple #2
0
        protected override void ExecuteCore(FunctionSwitch input, ExecuteResult output)
        {
            if (input.Command == ECommand.Interrupt)
            {
                var serviceName = input.ServiceType.ServiceType;

                if (GetStatus(serviceName) != EServiceStatus.Running)
                    return;

                var job = Scheduler.GetCurrentlyExecutingJobs().FirstOrDefault(zw => zw.JobDetail.Key.Name == serviceName);
                if (job == null)
                {
                    return;
                }

                var interrupt = job.JobInstance as IsolatedJob;
                interrupt.Interrupt();
            }
        }
        protected override void ExecuteCore(FunctionSwitch input, ExecuteResult output)
        {
            if (input.Command == ECommand.ModifySchedule)
            {
                var serviceName = input.ServiceType.ServiceType;
                var cronExpresion = input.ScheduleFormat;

                var triggerKey = serviceName.GetTriggerKey();
                var triggerName = serviceName + "Trigger";
                var trigger = Scheduler.GetTrigger(triggerKey);
                if (trigger != null)
                {
                    var cronBuilder = trigger as ICronTrigger;
                    JobCronExpressionConfig.SetCronExpression(triggerName, cronExpresion);
                    cronBuilder.CronExpressionString = cronExpresion;
                    var newTrigger = cronBuilder.GetTriggerBuilder().Build();
                    Scheduler.PauseTrigger(triggerKey);
                    Scheduler.RescheduleJob(triggerKey, newTrigger);
                    Scheduler.ResumeTrigger(triggerKey);
                }
            }
        }