We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
任务调度ScheduleTask: 实现IScheduleTask接口,添加 ScheduleTask 特性,指定任务调度时间表达式,即可实现任务调度。
IScheduleTask
/// <summary> /// KeepAlive ScheduleTask /// </summary> /// <param name="logger"></param> [ScheduleTask("* * * * *")] //每分钟一次 [ScheduleTask("0/3 * * * *")]//每3分钟执行一次 public class KeepAlive(ILogger<KeepAlive> logger) : IScheduleTask { public async Task ExecuteAsync() { logger.LogInformation("keep alive!"); await Task.CompletedTask; } }
支持从Store中初始化任务调度列表,支持动态添加任务调度,支持动态删除任务调度。
/// <summary> /// Demo ScheduleTask,用于Store演示 /// </summary> /// <param name="logger"></param> public class DemoTask(ILogger<DemoTask> logger) : IScheduleTask { public Task ExecuteAsync() { logger.LogInformation("Demo Schedule Done!"); return Task.CompletedTask; } } /// <summary> /// DemoStore演示 /// </summary> public class DemoStore : IScheduleMetadaStore { public Task<IEnumerable<ScheduleTaskMetadata>> GetAllAsync() { //模拟从数据库或配置文件中获取ScheduleTaskMetadata IEnumerable<ScheduleTaskMetadata> metadatas = [ new ScheduleTaskMetadata(typeof(DemoTask), "* * * * *") { Description="测试的Schedule" } ]; return Task.FromResult(metadatas); } }
最后注册DemoStore到DI容器中即可。
builder.Services.AddScheduleMetadaStore<DemoStore>();
The text was updated successfully, but these errors were encountered:
提供作业调度功能 #18
39d182e
提供任务调度的配置文件Store,ConfigurationStore #18
10d821b
增加了Schedule任务执行阶段的事件发布和订阅功能 #18
85a1b3c
更多帮助 https://github.com/vipwan/Biwen.QuickApi/tree/master/Biwen.QuickApi/Scheduling
Sorry, something went wrong.
优化代码,提供IScheduler调度器抽象化利于扩展
e4ebf4a
内部实现一个基于NCrontab的简易调度器(粒度为分)SampleNCrontabScheduler #18
添加了处理单一运行任务的功能
c48e3cd
在本次提交中,我们主要添加了处理同一时间只能存在一个的任务的功能。如果有相同的任务正在运行,那么当前的任务会被中断。#18
No branches or pull requests
任务调度ScheduleTask:
实现
IScheduleTask
接口,添加 ScheduleTask 特性,指定任务调度时间表达式,即可实现任务调度。支持从Store中初始化任务调度列表,支持动态添加任务调度,支持动态删除任务调度。
最后注册DemoStore到DI容器中即可。
The text was updated successfully, but these errors were encountered: