Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
        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");
        }
Ejemplo n.º 3
0
 public TestProbeActorRef(TestProbe owner)
 {
     this.owner = owner;
 }
Ejemplo n.º 4
0
 public TestProbeActorRef(TestProbe owner)
 {
     _owner = owner;
 }
Ejemplo n.º 5
0
 public TestProbeActorRef(TestProbe owner)
 {
     _owner = owner;
 }
Ejemplo n.º 6
0
 public TestProbeActorRef(TestProbe owner)
 {
     this.owner = owner;
 }