public void CanCreateActorUsingRemoteDaemonAndInteractWithChild() { var p = new TestProbe(); sys.EventStream.Subscribe(p.Ref, typeof(string)); var supervisor = sys.ActorOf<SomeActor>(); var provider = (RemoteActorRefProvider)sys.Provider; var daemon = provider.RemoteDaemon; var childCreatedEvent=new ManualResetEventSlim(); var path = (sys.Guardian.Path + "/foo").ToString(); //ask to create an actor MyRemoteActor, this actor has a child "child" daemon.Tell(new DaemonMsgCreate(Props.Create(() => new MyRemoteActor(childCreatedEvent)), null, path, supervisor)); //Wait for the child to be created (actors are instantiated async) childCreatedEvent.Wait(); //try to resolve the child actor "child" var child = provider.ResolveActorRef(provider.RootPath / "remote/user/foo/child".Split('/')); //pass a message to the child child.Tell("hello"); //expect the child to forward the message to the eventstream p.expectMsg("hello"); }
public void CanCreateActorUsingRemoteDaemonAndInteractWithChild() { var p = new TestProbe(); sys.EventStream.Subscribe(p.Ref, typeof(string)); var supervisor = sys.ActorOf<SomeActor>(); var provider = (RemoteActorRefProvider)sys.Provider; var daemon = provider.RemoteDaemon; //ask to create an actor MyRemoteActor, this actor has a child "child" daemon.Tell(new DaemonMsgCreate(Props.Create(() => new MyRemoteActor()), null, "user/foo", supervisor)); //try to resolve the child actor "child" var child = provider.ResolveActorRef(provider.RootPath / "remote/user/foo/child".Split('/')); //pass a message to the child child.Tell("hello"); //expect the child to forward the message to the eventstream p.expectMsg("hello"); }