示例#1
0
        public async Task <IActionResult> ResumeTrigger([FromBody] TriggerKeyModel model)
        {
            var key = new TriggerKey(model.Name, model.Group);
            await scheduler.ResumeTrigger(key);

            return(Ok("success"));
        }
示例#2
0
        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);
        }
示例#3
0
        /// <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());
        }
示例#4
0
        public async Task <string> ResumeTrigger(string triggerName, string triggerGroup)
        {
            var key = new TriggerKeyModel(triggerName, triggerGroup);

            return(await ResumeTrigger(key));
        }
示例#5
0
        public async Task <string> UnscheduleJob(string triggerName, string triggerGroup)
        {
            var key = new TriggerKeyModel(triggerName, triggerGroup);

            return(await UnscheduleJob(key));
        }