Without seeing compilation errors, I assume that system is undefined. By deploying an example from the documentation, something like this should work.
public class SchedulingTask { @Inject public SchedulingTask(final ActorSystem system, @Named("update-db-actor") ActorRef updateDbActor) { system.scheduler().schedule( Duration.create(0, TimeUnit.MILLISECONDS),
system is entered, and you can also enter a link to the actor. In addition, you can watch the actorβs referent with system .
After you have adapted this to do what you want, declare SchedulingTask in the module.
package com.example; import com.google.inject.AbstractModule; import play.libs.akka.AkkaGuiceSupport; public class MyModule extends AbstractModule implements AkkaGuiceSupport { @Override protected void configure() { bindActor(UpdateDbActor.class, "update-db-actor"); bind(SchedulingTask.class).asEagerSingleton(); } }
Finally, update the application to enable the module.
play.modules.enabled += "com.example.MyModule"
source share