標籤:trigger core context href ref info github ssi 安裝
github:https://github.com/zzhi/JobEngine
基於quartz.net 的跨平台作業架構
quartz.net(https://github.com/quartznet/quartznet/tree/features/netcore11) 也支援跨平台了 ,由於NuGet無法安裝quartz-DotNetCore dll。
所以我直接把這個解決方案下載下來,刪除一些無用的代碼,在解決方案上直接建立項目JobServer, 通過添加引用的方式引用quartz-DotNetCore
如何建立新的作業?
1,Jobs項目中建立TestJob.cs ,代碼如下:
[DisallowConcurrentExecution]public class TestJob : IJob{ public Task Execute(IJobExecutionContext context) { Log.Information(DateTime.Now.ToString()); return Task.FromResult(0); }}TestJob作業僅僅列印目前時間。
2,修改JobService項目的quartz_jobs.xml,如下:
<job> <name>TestJob</name> <group>TestJobGroup</group> <description>TestJob</description> <job-type>Jobs.TestJob, Jobs</job-type> <durable>true</durable> <recover>false</recover></job><trigger> <cron> <name>TestJobTrigger</name> <group>TestJobTriggerGroup</group> <job-name>TestJob</job-name> <job-group>TestJobGroup</job-group> <cron-expression>0/5 * * * * ?</cron-expression> </cron></trigger>
3,重新啟動
JobEngine 基於quartz.net 跨平台作業架構