public async Task <ActionResult> ResumeJob(JobKey jobKey) { var result = await SchedulerCenter.ResumeJobAsync(jobKey); return(MyJson(result)); //if (!result.Success) //{ // return MyJson(result); //} //var updateResult = await SysQuartzBll.ModifyTaskState(jobKey.Group, jobKey.Name, MyTriggerState.Normal); //return updateResult ? Succeed() : Fail("恢复运行失败"); }
public async Task <ActionResult> DeleteJob(JobKey jobKey) { var result = await SchedulerCenter.StopOrDelScheduleJobAsync(jobKey, true); return(MyJson(result)); //if (!result.Success) //{ // return MyJson(result); //} //var updateResult = await SysQuartzBll.ModifyTaskState(jobKey.Group, jobKey.Name, MyTriggerState.Delete); //return updateResult ? Succeed() : Fail("删除失败"); }
public async Task <ActionResult> ModifyJob(ScheduleEntityParam entity) { var result = await SchedulerCenter.StopOrDelScheduleJobAsync(new JobKey(entity.JobName, entity.JobGroup), true); if (!result.Success) { return(MyJson(result)); } result = await SchedulerCenter.AddScheduleJobAsync(entity); if (result.Success) { result = await SysQuartzBll.ModifyTask(entity); } return(MyJson(result)); }
public async Task <ActionResult> AddTask(ScheduleEntityParam entity) { // 判断存在 if (await SysQuartzBll.ExistTask(entity)) { return(Fail("任务名称已存在,请进行修改原任务,或使用新名称")); } var result = await SchedulerCenter.AddScheduleJobAsync(entity); if (!result.Success) { return(MyJson(result)); } var addResult = await SysQuartzBll.AddTask(entity); return(addResult ? Succeed() : Fail("添加失败")); }
private SchedulerCenter GetScheduler() { string dbProviderName = Configuration.GetSection("Quartz")["dbProviderName"]; string connectionString = Configuration.GetSection("Quartz")["connectionString"]; string driverDelegateType = string.Empty; switch (dbProviderName) { case "SQLite-Microsoft": case "SQLite": driverDelegateType = typeof(SQLiteDelegate).AssemblyQualifiedName; break; case "MySql": driverDelegateType = typeof(MySQLDelegate).AssemblyQualifiedName; break; case "OracleODPManaged": driverDelegateType = typeof(OracleDelegate).AssemblyQualifiedName; break; case "SQLServer": case "SQLServerMOT": driverDelegateType = typeof(SqlServerDelegate).AssemblyQualifiedName; break; case "Npgsql": driverDelegateType = typeof(PostgreSQLDelegate).AssemblyQualifiedName; break; case "Firebird": driverDelegateType = typeof(FirebirdDelegate).AssemblyQualifiedName; break; default: throw new System.Exception("dbProviderName unreasonable"); } SchedulerCenter schedulerCenter = SchedulerCenter.Instance; schedulerCenter.Setting(new DbProvider(dbProviderName, connectionString), driverDelegateType); return(schedulerCenter); }
public JobController() { scheduler = SchedulerCenter.Instance; }
/// <summary> /// 任务调度对象 /// </summary> /// <param name="schedulerCenter"></param> public JobController(SchedulerCenter schedulerCenter) { this.scheduler = schedulerCenter; }
public ActionResult ScheduleState() { return(Succeed(SchedulerCenter.ScheduleAState())); }
public async Task <ActionResult> StopSchedule() { return(Succeed(await SchedulerCenter.StopScheduleAsync())); }
/// <summary> /// 任务调度对象 /// </summary> /// <param name="schedulerCenter"></param> public JobController(SchedulerCenter schedulerCenter, IDistributedCache cache) { _scheduler = schedulerCenter; _cache = cache; }
public HostedService(SchedulerCenter schedulerCenter) { this.schedulerCenter = schedulerCenter; }
/// <summary> /// 获取正在运行的Jobs /// </summary> /// <returns></returns> private object GetAllRuningJob() { return(SchedulerCenter.GetInstance().ScheduleList); }
public async Task get_all_job() { SchedulerCenter scheduler = SchedulerCenter.Instance; var jobs = await scheduler.GetAllJobAsync(); }
public HostedService(SchedulerCenter schedulerCenter) { this.schedulerCenter = schedulerCenter; mqttManager = MqttManager.Instance; }