I am trying to create a job in java play2 using akka.
I always get the same error error: cannot find symbol
And it points to system.actorOf()
Intellij and Eclipse don't give me an error msg.
But I can not find this method. I used the following imports
import play.libs.Akka;
import akka.actor.ActorSystem;
import akka.actor.ActorRef;
import akka.actor.UntypedActorFactory;
import akka.actor.UntypedActor;
import akka.actor.Props;
import akka.actor.ActorRefFactory;
Maybe the docs are outdated and they have removed the system.actorOf()
?
public class Global extends GlobalSettings {
ActorRef tickActor = system.actorOf(new Props().withCreator(new UntypedActorFactory() {
public UntypedActor create() {
return new UntypedActor() {
public void onReceive(Object message) {
if (message.equals("Log")) {
controllers.Application.log();
} else {
unhandled(message);
}
}
};
}
}));
@Override
public void onStart(Application app) {
Cancellable cancellable = system.scheduler().schedule(Duration.Zero(), Duration.create(10, TimeUnit.SECONDS),
tickActor, "Log");
}
}
EDIT:
.
oh... google redirected me to the outdated documentation. It's Akka.System()
now..
- Can anyone give me an example on how to create the tickActor with up2date code?
http://www.playframework.org/documentation/2.0.2/JavaAkka