I am trying to use akka-quartz-scheduler to trigger a cleanup event at regular intervals. I get a scheduler to send a message to the actor, but only when there is no calendar associated with the schedule. Whenever I tie a calendar to a schedule, the actor never receives any messages.
This is the application.conf section related to akka-quartz-scheduler. If I delete the line
calendars = ["Minimum value"] "
from the configuration, my actor starts up. If I leave the line, no actor will be called.
akka { quartz { defaultTimezone = "Europe/Oslo" schedules { NowAndThen { description ="Delete temp files now and then, eg every hour" expression = "*/10 * * * * ?" calendars = ["Minimal"] } } calendars { Minimal { type = Daily exclude { startTime = "15:00" endTime = "15:01" } } } } }
I initialize the extension from the playframework application in Global.java:
import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.actor.Extension; import akka.actor.Props; import com.typesafe.akka.extension.quartz.QuartzSchedulerExtension; import play.Application; import play.GlobalSettings; import play.Logger; import play.libs.Akka; import uttrekk.CleanupRunner; public class Global extends GlobalSettings { public void onStart(Application app) { AkkaStartUp.startup(app); } static class AkkaStartUp { public static void startup(Application app) {
The actorβs implementation looks something like this:
package uttrekk; import akka.actor.UntypedActor; import play.Logger; import util.NewProperties; import java.io.File; import java.io.FilenameFilter; public class CleanupRunner extends UntypedActor { @Override public void onReceive(Object message) throws Exception { Logger.info("Running cleanup of temporary files"); } }
akka quartz-scheduler
Leif jantzen
source share