# Sundial
[![license](https://img.shields.io/badge/license-MIT-orange?cacheSeconds=10800)](https://gitee.com/dotnetchina/Sundial/blob/master/LICENSE) [![nuget](https://img.shields.io/nuget/v/Sundial.svg?cacheSeconds=10800)](https://www.nuget.org/packages/Sundial) [![dotNET China](https://img.shields.io/badge/organization-dotNET%20China-yellow?cacheSeconds=10800)](https://gitee.com/dotnetchina)
.NET 功能齐全的开源分布式作业调度系统,可从最小的应用程序到大型企业系统使用。
![Sundial.drawio](https://gitee.com/dotnetchina/Sundial/raw/master/drawio/Sundial.drawio.png "Sundial.drawio.png")
## 安装
```powershell
dotnet add package Sundial
```
## 快速入门
我们在[主页](https://furion.baiqian.ltd/docs/job/)上有不少例子,这是让您入门的第一个:
1. 定义作业,并实现 `IJob` 接口:
```cs
public class MyJob : IJob
{
private readonly ILogger<MyJob> _logger;
public MyJob(ILogger<MyJob> logger)
{
_logger = logger;
}
public Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
_logger.LogInformation(context.ToString());
return Task.CompletedTask;
}
}
```
2. 在 `Startup.cs` 注册 `AddSchedule` 服务和作业:
```cs
services.AddSchedule(options =>
{
options.AddJob<MyJob>(Triggers.PeriodSeconds(5)); // 5s 执行一次
});
```
3. 运行项目:
```diff
info: 2022-12-05 19:32:56.3835407 +08:00 星期一 L System.Logging.ScheduleService[0] #1
Schedule hosted service is running.
info: 2022-12-05 19:32:56.3913451 +08:00 星期一 L System.Logging.ScheduleService[0] #1
Schedule hosted service is preloading...
info: 2022-12-05 19:32:56.4322887 +08:00 星期一 L System.Logging.ScheduleService[0] #1
The <job1_trigger1> trigger for scheduler of <job1> successfully appended to the schedule.
info: 2022-12-05 19:32:56.4347959 +08:00 星期一 L System.Logging.ScheduleService[0] #1
The scheduler of <job1> successfully appended to the schedule.
warn: 2022-12-05 19:32:56.4504555 +08:00 星期一 L System.Logging.ScheduleService[0] #1
Schedule hosted service preload completed, and a total of <1> schedulers are appended.
info: 2022-12-05 19:33:01.5100177 +08:00 星期一 L MyJob[0] #13
+ <job1> [C] <job1 job1_trigger1> 5s 1ts 2022-12-05 19:33:01.395 -> 2022-12-05 19:33:06.428
info: 2022-12-05 19:33:06.4676792 +08:00 星期一 L MyJob[0] #13
+ <job1> [C] <job1 job1_trigger1> 5s 2ts 2022-12-05 19:33:06.428 -> 2022-12-05 19:33:11.435
info: 2022-12-05 19:33:11.4460946 +08:00 星期一 L MyJob[0] #16
+ <job1> [C] <job1 job1_trigger1> 5s 3ts 2022-12-05 19:33:11.435 -> 2022-12-05 19:33:16.412
```
`JobExecutionContext` 重写了 `ToString()` 方法并提供以下几种格式:
```bash
# 持续运行格式
<作业Id> 作业描述 [并行C/串行S] <作业Id 触发器Id> 触发器字符串 触发器描述 触发次数ts 触发时间 -> 下一次触发时间
# 触发停止格式
<作业Id> 作业描述 [并行C/串行S] <作业Id 触发器Id> 触发器字符串 触发器描述 触发次数ts 触发时间 [触发器终止状态]
```
[更多文档](https://furion.baiqian.ltd/docs/job/)
## 文档
您可以在[主页](https://furion.baiqian.ltd/docs/job/)找到 Sundial 文档。
## 贡献
该存储库的主要目的是继续发展 Sundial 核心,使其更快、更易于使用。Sundial 的开发在 [Gitee](https://gitee.com/dotnetchina/Sundial) 上公开进行,我们感谢社区贡献错误修复和改进。
## 许可证
Sundial 采用 [MIT](./LICENSE) 开源许可证。
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
.NET 功能齐全的开源分布式作业调度系统,可从最小的应用程序到大型企业系统使用。.zip (114个子文件)
SchedulerFactory.Exports.cs 48KB
ISchedulerFactory.Exports.cs 29KB
Trigger.Methods.cs 25KB
SchedulerBuilder.cs 21KB
TriggerBuilder.cs 21KB
Scheduler.Methods.cs 20KB
ScheduleOptionsBuilder.cs 20KB
ScheduleHostedService.cs 19KB
SchedulerFactory.Internal.cs 19KB
JobDetail.Methods.cs 13KB
JobBuilder.cs 13KB
ScheduleUIMiddleware.cs 12KB
Triggers.cs 11KB
ScheduleExtensions.cs 11KB
TriggerBuilder.Setters.cs 10KB
Penetrates.cs 10KB
IScheduler.cs 9KB
Trigger.cs 5KB
Retry.cs 5KB
ScheduleServiceCollectionExtensions.cs 5KB
Schedular.cs 4KB
TriggerAttribute.cs 4KB
HttpJob.cs 4KB
ScheduleLogger.cs 4KB
PersistenceTriggerContext.cs 4KB
TP.cs 4KB
JobExecutionContext.cs 4KB
PersistenceContext.cs 3KB
ScheduleUIExtensions.cs 3KB
ISchedulerFactory.Internal.cs 3KB
JobDetail.cs 3KB
JobDetailAttribute.cs 3KB
PeriodTrigger.cs 3KB
IScheduleLogger.cs 3KB
CronTrigger.cs 3KB
TriggerStatus.cs 3KB
Scheduler.cs 2KB
JobDetailOptions.cs 2KB
DateTimeJsonConverter.cs 2KB
TriggerTimeline.cs 2KB
IJobClusterServer.cs 2KB
JobExecutedContext.cs 2KB
IJobPersistence.cs 2KB
CronAttribute.cs 2KB
JobExecutingContext.cs 2KB
IJobMonitor.cs 2KB
IJob.cs 2KB
TriggerOptions.cs 2KB
RepeatKeyEqualityComparer.cs 2KB
ScheduleUIOptions.cs 2KB
HttpJobMessage.cs 2KB
DynamicJob.cs 2KB
SqlTypes.cs 2KB
IJobExecutor.cs 2KB
NamingConventions.cs 2KB
JobFactoryContext.cs 2KB
IJobFactory.cs 2KB
ScheduleResult.cs 1KB
SchedulerModel.cs 1KB
PeriodAttribute.cs 1KB
SecondlyAtAttribute.cs 1KB
PeriodHoursAttribute.cs 1KB
PeriodMinutesAttribute.cs 1KB
WeeklyAtAttribute.cs 1KB
SchedulerEventArgs.cs 1KB
YearlyAtAttribute.cs 1KB
MonthlyAtAttribute.cs 1KB
PeriodSecondsAttribute.cs 1KB
MinutelyAtAttribute.cs 1KB
JobClusterContext.cs 1KB
HourlyAtAttribute.cs 1KB
DailyAtAttribute.cs 1KB
WorkdayAttribute.cs 1KB
YearlyAttribute.cs 1KB
MonthlyAttribute.cs 1KB
WeeklyAttribute.cs 1KB
MinutelyAttribute.cs 1KB
DailyAttribute.cs 1KB
SecondlyAttribute.cs 1KB
HourlyAttribute.cs 1KB
ClusterStatus.cs 1KB
PersistenceBehavior.cs 1KB
Logging.cs 1KB
MyJob.cs 368B
Program.cs 322B
Sundial.csproj 2KB
Sundial.Dashboard.csproj 473B
Sundial.Samples.csproj 328B
main.ce997901.css 220KB
Sundial.drawio 5KB
.editorconfig 7KB
.gitignore 6KB
index.html 704B
favicon.ico 4KB
main.d40a4a2e.js 841KB
apiconfig.js 167B
launchSettings.json 777B
asset-manifest.json 434B
appsettings.json 142B
appsettings.Development.json 119B
共 114 条
- 1
- 2
资源评论
白话机器学习
- 粉丝: 9306
- 资源: 7681
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 端午节相关庆祝代码.docx
- 端午节相关庆祝代码.docx
- MixedRealityFeatureTool:MRTK 混合现实功能工具
- 618节日相关的数据分析.docx
- 618节日相关的数据分析.docx
- FileZilla Server cn 0.9.60.2
- ·····C语言使用到的文件
- procedural-mathematical-knowledge-and-use-of-technology-by-senior-high-school-students-12712.pdf
- Linux Qt5.13.2 编译QWebEngine源码支持音视频<aarch64>
- vue3学习,基础知识
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功