JobEngine 基於quartz.net 跨平台作業架構

來源:互聯網
上載者:User

標籤: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 跨平台作業架構

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.