Akka-quartz scheduler never launches my actor

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) { // Starter autoamtiske avelveringer norges eiendommer ActorSystem system = Akka.system(); ActorRef cleanupRef =system.actorOf(new Props(CleanupRunner.class)); QuartzSchedulerExtension scheduler = (QuartzSchedulerExtension) QuartzSchedulerExtension.get(system); scheduler.schedule("NowAndThen",cleanupRef,"Clean"); } } } 

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"); } } 
+7
akka quartz-scheduler
source share
1 answer

The problem occurs during the initialization of calendars. Check line 245 in the QuartzSchedulerExtension class: scheduler.addCalendar (name.toUpperCase, calendar, true, true)

The calendar is added using UpperCase, so Quartz never finds it, creating that then no task starts. If you define your calendar in akka configuration using the name UpperCase, it should work.

+2
source share

All Articles