public async Task <IActionResult> ResumeTrigger([FromBody] TriggerKeyModel model) { var key = new TriggerKey(model.Name, model.Group); await scheduler.ResumeTrigger(key); return(Ok("success")); }
static void Main(string[] args) { var key = new TriggerKeyModel("test", "test"); var client = new HttpClient { BaseAddress = new Uri("http://localhost:5000") }; var httpQuartzClient = new HttpQuartzClient(client); var result = httpQuartzClient.ScheduleJob(new TriggerModel() { Key = key, StartTime = DateTimeOffset.Now.AddSeconds(30), JobData = new JobDataInfo() { url = "http://localhost:5000/home/Time", }, SimpleTrigger = new SimpleTriggerInfo() { RepeatInterval = TimeSpan.FromSeconds(10) }, }).GetAwaiter().GetResult(); Console.WriteLine(result); }
/// <summary> /// 恢复触发器,成功返回success /// </summary> /// <param name="model"></param> /// <returns></returns> public async Task <string> ResumeTrigger(TriggerKeyModel model) { var json = JsonSerializer.Serialize(model, JsonSerializerOptions); StringContent content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await httpClient.PostAsync("/Quartz/ResumeTrigger", content); return(await response.Content.ReadAsStringAsync()); }
public async Task <string> ResumeTrigger(string triggerName, string triggerGroup) { var key = new TriggerKeyModel(triggerName, triggerGroup); return(await ResumeTrigger(key)); }
public async Task <string> UnscheduleJob(string triggerName, string triggerGroup) { var key = new TriggerKeyModel(triggerName, triggerGroup); return(await UnscheduleJob(key)); }