我正在尋找Quartz.net for Console應用程序 的工作簡單示例(只要足夠簡單,它可以是任何其他應用程序...)。 雖然我在那裏,沒有任何包裝,可以幫助我避免執行 IJobDetail,ITrigger等Quartz.net的簡單工作示例
回答
在源代碼中的文檔和樣品之間應該有足夠讓你開始。創建自定義作業時,必須實現的唯一界面是IJob
。所有其他接口已經爲您實施,或者在quartz.net中不需要它們的基本用法。
建立作業和觸發器使用JobBuilder和TriggerBuilder助手對象。
有一個人做出了與你完全相同的觀察,並且他發表了一篇博客文章,其中包含一個Quartz.net控制檯應用程序的簡單工作示例。
以下是針對Quartz.net 2.0(最新版)構建的Quartz.net示例。這項工作的作用是每5秒在控制檯上寫一條短信,「Hello Job is executed」。
啓動Visual Studio 2012項目。選擇Windows Console Application
。將其命名爲Quartz1或者你喜歡什麼。
要求 下載使用NuGet
Quartz.NET
組裝。右鍵單擊項目,選擇「管理Nuget包」。然後搜索Quartz.NET
。一旦找到選擇並安裝。
using System;
using System.Collections.Generic;
using Quartz;
using Quartz.Impl;
namespace Quartz1
{
class Program
{
static void Main(string[] args)
{
// construct a scheduler factory
ISchedulerFactory schedFact = new StdSchedulerFactory();
// get a scheduler, start the schedular before triggers or anything else
IScheduler sched = schedFact.GetScheduler();
sched.Start();
// create job
IJobDetail job = JobBuilder.Create<SimpleJob>()
.WithIdentity("job1", "group1")
.Build();
// create trigger
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.WithSimpleSchedule(x => x.WithIntervalInSeconds(5).RepeatForever())
.Build();
// Schedule the job using the job and trigger
sched.ScheduleJob(job, trigger);
}
}
/// <summary>
/// SimpleJOb is just a class that implements IJOB interface. It implements just one method, Execute method
/// </summary>
public class SimpleJob : IJob
{
void IJob.Execute(IJobExecutionContext context)
{
//throw new NotImplementedException();
Console.WriteLine("Hello, JOb executed");
}
}
}
來源
不幸的是斷開的鏈接。 – Manachi 2015-11-13 05:15:20
我們很幸運,它在archive.org上! https://web.archive.org/web/20150707071411/http://hammadk.com/quartz-net-working-example 把它放在pastie上只是爲了確保: http://pastie.org/10681194 – 2016-01-10 14:26:37
- 1. 簡單工作VB.net中的json.net示例
- 2. 簡單的jQuery .load示例不工作
- 3. Python簡單ProcessPoolExecutor示例不會工作
- 4. 簡單require.extensions示例不工作
- 5. quartz.net簡單示例按給定的時間
- 6. 簡單的引導工具提示示例不起作用
- 7. 簡單的ResourceManager示例不能在單元測試中工作
- 8. 製作一個非常簡單的ajax示例工作
- 9. 如何製作簡單的futures :: sync :: mpsc :: channel示例工作?
- 10. 簡單單例EJB示例
- 11. 簡單的open3例子不工作
- 12. flickr-fu簡單的例子不工作
- 13. Ajax簡單的例子不工作
- 14. JavaCC簡單的例子不工作
- 15. Alchemy.js簡單的例子不工作
- 16. 簡單的jsfiddle示例不起作用
- 17. 簡單的RESTtEasy示例不起作用
- 18. 簡單的_putenv示例不起作用
- 19. Spring數據的最簡單的工作示例JPA
- 20. PyQt - QTableView內組合框的最簡單的工作示例
- 21. Quartz.Net工作進展
- 22. NHibernate工作單元示例
- 23. 無法得到簡單的ParseKit示例工作
- 24. 無法得到簡單的PreferenceFragment示例工作
- 25. Redux WP Framework。一個簡單的工作代碼示例?
- 26. 這個簡單的PrimeNG Angular 2示例如何工作?
- 27. 令人難以置信的簡單Log4j 2.0示例不工作
- 28. 簡單的駝鹿::出口商示例不工作
- 29. 非常簡單的jQuery .load示例不工作
- 30. 我無法讓JUnit在簡單的Java示例上工作
http://www.quartz-scheduler.net/documentation/quartz-2.x/quick-start。 html – 2016-09-05 15:24:55