1 people like it.
Like the snippet!
Quartz Job Scheduling
A simple example showing how to use Quartz.NET, an open source job scheduling system, with FSharp.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
|
open System
open Quartz
open Quartz.Impl
let schedulerFactory = StdSchedulerFactory()
let scheduler = schedulerFactory.GetScheduler()
scheduler.Start()
type Job () =
interface IJob with
member x.Execute(context: IJobExecutionContext) =
Console.WriteLine(DateTime.Now)
let job = JobBuilder.Create<Job>().Build()
let trigger =
TriggerBuilder.Create()
.WithSimpleSchedule(fun x ->
x.WithIntervalInSeconds(1).RepeatForever() |> ignore)
.Build()
scheduler.ScheduleJob(job, trigger) |> ignore
//scheduler.Shutdown()
// Output:
// 09/10/2012 11:08:03
// 09/10/2012 11:08:04
// 09/10/2012 11:08:05
// 09/10/2012 11:08:06
// 09/10/2012 11:08:07
// 09/10/2012 11:08:08
// 09/10/2012 11:08:09
// 09/10/2012 11:08:10
// 09/10/2012 11:08:11
// 09/10/2012 11:08:12
// ...
|
namespace System
val schedulerFactory : obj
val scheduler : obj
Multiple items
type Job =
interface obj
new : unit -> Job
override Execute : context:'a -> unit
--------------------
new : unit -> Job
val x : Job
val context : 'a
type Console =
static member BackgroundColor : ConsoleColor with get, set
static member Beep : unit -> unit + 1 overload
static member BufferHeight : int with get, set
static member BufferWidth : int with get, set
static member CapsLock : bool
static member Clear : unit -> unit
static member CursorLeft : int with get, set
static member CursorSize : int with get, set
static member CursorTop : int with get, set
static member CursorVisible : bool with get, set
...
Console.WriteLine() : unit
(+0 other overloads)
Console.WriteLine(value: string) : unit
(+0 other overloads)
Console.WriteLine(value: obj) : unit
(+0 other overloads)
Console.WriteLine(value: uint64) : unit
(+0 other overloads)
Console.WriteLine(value: int64) : unit
(+0 other overloads)
Console.WriteLine(value: uint32) : unit
(+0 other overloads)
Console.WriteLine(value: int) : unit
(+0 other overloads)
Console.WriteLine(value: float32) : unit
(+0 other overloads)
Console.WriteLine(value: float) : unit
(+0 other overloads)
Console.WriteLine(value: decimal) : unit
(+0 other overloads)
Multiple items
type DateTime =
struct
new : ticks:int64 -> DateTime + 10 overloads
member Add : value:TimeSpan -> DateTime
member AddDays : value:float -> DateTime
member AddHours : value:float -> DateTime
member AddMilliseconds : value:float -> DateTime
member AddMinutes : value:float -> DateTime
member AddMonths : months:int -> DateTime
member AddSeconds : value:float -> DateTime
member AddTicks : value:int64 -> DateTime
member AddYears : value:int -> DateTime
...
end
--------------------
DateTime ()
(+0 other overloads)
DateTime(ticks: int64) : DateTime
(+0 other overloads)
DateTime(ticks: int64, kind: DateTimeKind) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, calendar: Globalization.Calendar) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: DateTimeKind) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: Globalization.Calendar) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: DateTimeKind) : DateTime
(+0 other overloads)
property DateTime.Now: DateTime with get
val job : obj
val trigger : obj
val ignore : value:'T -> unit
More information