37 lines
1.6 KiB
C#
37 lines
1.6 KiB
C#
|
|
using FluentScheduler;
|
|||
|
|
namespace Face.SystemTask
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 定时作业计划注册管理
|
|||
|
|
/// </summary>
|
|||
|
|
public class TimingPlanRegistry : Registry
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 定时作业计划注册 自定义
|
|||
|
|
/// </summary>
|
|||
|
|
public TimingPlanRegistry()
|
|||
|
|
{
|
|||
|
|
//NonReentrant防止并发,ToRunNow指定并立即执行后重复执行,ToRunEvery指定后重复执行,ToRunOnceIn指定后执行一次,
|
|||
|
|
|
|||
|
|
//Schedule<TimingPlanJob.PlanJob1>().WithName(Enum.TimingPlan.Plan1.ToString()).NonReentrant().ToRunEvery(30).Seconds();
|
|||
|
|
|
|||
|
|
//Schedule<TimingPlanJob.PlanJob2>().WithName(Enum.TimingPlan.Plan2.ToString()).NonReentrant().ToRunEvery(1).Minutes();
|
|||
|
|
|
|||
|
|
//Schedule<TimingPlanJob.PlanJob3>().WithName(Enum.TimingPlan.Plan3.ToString()).NonReentrant().ToRunEvery(1).Days().At(14, 25);
|
|||
|
|
|
|||
|
|
//Schedule<TimingPlanJob.PlanJob4>().WithName(Enum.TimingPlan.Plan4.ToString()).NonReentrant().ToRunEvery(1).Weekdays().At(14, 25);
|
|||
|
|
|
|||
|
|
//Schedule<TimingPlanJob.PlanJob4>().WithName(Enum.TimingPlan.Plan5.ToString()).NonReentrant().ToRunEvery(1).Months().On(16).At(14, 23);
|
|||
|
|
|
|||
|
|
//一分钟执行一次
|
|||
|
|
Schedule<TimingPlanJob.CustomPlanJob1>().WithName("CustomTimingPlan1").NonReentrant().ToRunEvery(1).Minutes();
|
|||
|
|
|
|||
|
|
//60秒
|
|||
|
|
//Schedule<TimingPlanJob.CustomPlanJob2>().WithName("CustomTimingPlan2").NonReentrant().ToRunEvery(60).Seconds();
|
|||
|
|
|
|||
|
|
//一分钟
|
|||
|
|
//Schedule<TimingPlanJob.CustomPlanJob3>().WithName("CustomTimingPlan3").NonReentrant().ToRunEvery(1).Minutes();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|