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, ""));
Docs: http://doc.akka.io/docs/akka/current/java/actors.html#Props
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With