2015-05-06 98 views
5

如何在java中使用自定義構造函數創建actor?我已經通過文檔搜索,但沒有找到它。Akka Java:使用構造函數創建參數參數

這裏是我的演員:

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 { 


} 
} 

我已經試過這樣:

 ActorRef imageActorRef = system.actorOf(
      Props.create(new ResizePhotoActor(1, 2, ""))); 

但它不工作。

謝謝

回答