scala - Calling tell on an actor with a new properties file -
i'm creating actor :
mysupervisor = actorsys.actorof(props.create(myactor.class, createproperties())); public myproperties createproperties(){ myproperties mp = new myproperties(); mp.setparam1("test1"); mp.setparam2("test2"); return mp; } public class myproperties { private string param1; private string param2; public string getparam1() { return param1; } public void setparam1(string param1) { this.param1 = param1; } public string getparam2() { return param2; } public void setparam2(string param2) { this.param2 = param2; } }
myactor :
public class myactor extends untypedactor{ private myproperties props; @override public void onreceive(object argmessage) throws exception { if(argmessage instanceof myproperties ){ this.props = (myproperties) argmessage; } actorref newactor = getcontext().actorof(props.create(newactor.class, this.props)); newactor.tell(.... work) } }
the myproperties object can change @ runtime populated external configuration file update actor myactor these properties use :
mysupervisor.tell(createproperties(), mysupervisor);
testing behaves expected new actors created mysupervisor
contains correct properties, correct method of achieving ? : calling tell method on mysupervisor
passing in new instance of myproperties
, passing in mysupervisor
reference ?
Comments
Post a Comment