Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="jobType"></param>
 /// <returns></returns>
 public static async Task ForceJobExecutionAsync(JobTypeEnum jobType)
 {
     if (_scheduler == null)
     {
         return;
     }
     var jobKey     = jobType.GetJobKey();
     var jobDataMap = new JobDataMap {
         { IS_FORCED, true }
     };
     await _scheduler.TriggerJob(jobKey, jobDataMap).ConfigureAwait(false);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Force job
        /// </summary>
        /// <param name="jobType"></param>
        public static void ForceJobExecution(JobTypeEnum jobType)
        {
            if (_scheduler == null)
            {
                return;
            }
//            var trigger = jobType.GetTrigger();
//            if (_scheduler.GetTriggerState(trigger.Key).Result == TriggerState.Paused)
//            {
//                throw new Exception($"Trigger of '{jobType}' is paused.");
//            }

            var jobKey     = jobType.GetJobKey();
            var jobDataMap = new JobDataMap {
                { IS_FORCED, true }
            };

            _scheduler.TriggerJob(jobKey, jobDataMap).Wait();
        }