This is the Quartz integration plugin for Akka.NET.
Install:
PM>Install-Package Akka.Quartz.Actor
Create a Receiver:
class Receiver: ActorBase
{
public MyActor()
{
}
protected override bool Receive(object message)
{
//handle scheduled message here
}
}
var receiver = Sys.ActorOf(Props.Create(() => new Receiver()), "Receiver");
Create a QuartzActor:
var quartzActor = Sys.ActorOf(Props.Create(() => new QuartzActor()), "QuartzActor");
Send "Hello" message to Receiver Actor:
quartzActor.Tell(new CreateJob(receiver, "Hello", TriggerBuilder.Create().WithCronSchedule( " * * * * * ?").Build())));
Now message "Hello" will be delivered to receiver every 5 seconds.
The persistent quartz scheduling actor. This allows the jobs to be persisted in the Quartz jobstore and then to work in a new instance of application with new incarnations of the actors.
var quartzPersistentActor = Sys.ActorOf(Props.Create(() => new QuartzPersistentActor()), "QuartzActor");
quartzPersistentActor.Tell(new CreatePersistentJob(receiver, "Hello", TriggerBuilder.Create().WithCronSchedule("*0/10 * * * * ?").Build()));
For more information, please see the unit test.
For more information about quartz scheduler please see http://www.quartz-scheduler.net/documentation/ For more information about akka .net please see http://getakka.net/docs/