akka-quartz-scheduler:找不到时间表的匹配石英配置

时间:2019-04-18 20:01:48

标签: akka scheduler

我正在尝试运行akka-quartz-scheduler的示例,获得了akka-quickstart-java,并为调度程序示例创建了一个新的主类,然后添加了application.conf(在main / resources下),然后将依赖项添加到build.sbt。

我尝试使用ConfigFactory.load()手动加载Config,我正确地获取了配置文件的内容,但是看来schedulerExtension从未看到该文件。

SchedulerQuickstart.java

public class SchedulerQuickstart {
    public static void main(String[] args){
        final ActorSystem system = ActorSystem.create("helloscheduler");
        try {
            QuartzSchedulerExtension schedulerExtension = new QuartzSchedulerExtension((ExtendedActorSystem) system);
            Date firstExecutionDate=schedulerExtension.schedule("GreetingSchedule",
                    system.actorOf(Printer.props(), "printerActor"),
                    new Printer.Greeting("This is an scheduled message"));
        }
        catch (Exception ex){
        }
        finally {
            system.terminate();
        }
   }
}

application.conf

akka.quartz.schedules {
  GreetingSchedule {
    description = "Task that fires off every 30 seconds"
    expression = "*/30 * * ? * *"
    maxRetries = 2
  }
}

在build.sbt中:

"com.enragedginger" %% "akka-quartz-scheduler" % "1.8.0-akka-2.5.x"

运行代码时,我得到: 找不到时间表“ GreetingSchedule”的匹配石英配置

0 个答案:

没有答案