How could i create an actor with a customized constructor in java ? I have searched through the documentation but didn't found it.
Here is my Actor:
public class ResizePhotoActor extends UntypedActor {
private int width;
private int height;
private String caption;
public ResizePhotoActor(int width, int height, String caption) {
this.height = height;
this.width = width;
this.caption = caption;
}
public void onReceive(Object message) throws Exception {
}
}
I have tried this :
ActorRef imageActorRef = system.actorOf(
Props.create(new ResizePhotoActor(1, 2, "")));
But it doesn't work.
Thank you
解决方案
ActorRef imageActorRef = system.actorOf(Props.create(ResizePhotoActor.class, 1, 2, ""));