Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
akka.net remote test
akka.net remote test
@billyxing

This comment has been minimized.

Copy link
Owner Author

@billyxing billyxing commented Aug 14, 2015

gist

the pic above is what happend one the server when I shutdown a client.

Server side code:

create Actor System
MyActorSystem = ActorSystem.Create("TestServer");
MyActorSystem.ActorOf(Props.Create(() => new ServerActor()), "MyServerActor");

ServerActor has a child actor which has a hashset to store clients path. When a client starts, it first sends a ClientConnectRequest to ServerActor, Then ServerActor pass this message to its child actor to handle it.

child actor add Watch to client:

public void Handle(ClientConnectRequest message) `
   {
            _subscriptions.Add(message);
            Console.WriteLine("add subscription:" + message.ClientCN);

            Context.Watch(message.Subscriber);
        }

child actor Handle terminated message

      public void Handle(Terminated message)
        {
            Console.WriteLine("receive unsubscription:" + message.ToString());
            _subscriptions.RemoveWhere(p => p.Subscriber == message.ActorRef);
            Console.WriteLine(message.ToString());
        }
@Aaronontheweb

This comment has been minimized.

Copy link

@Aaronontheweb Aaronontheweb commented Aug 14, 2015

Looks like you're getting the unsubscription in the screenshot above: receive unsubscription:<Terminated> - is that not what you expected?

@billyxing

This comment has been minimized.

Copy link
Owner Author

@billyxing billyxing commented Aug 15, 2015

what i want to konw is that after i received the unsubscription:, why the server print out the same exception again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.