public ActorRef(IPEndPoint location, ActorKey key)
 {
     Key           = key;
     _locationIp   = location.Address.GetAddressBytes();
     _locationPort = location.Port;
     _location     = location;
 }
        public Task <IActorProxy> GetActor(ActorKey actorKey)
        {
            lock (_whole)
            {
                IActor actor = _actors.ContainsKey(actorKey) ? _actors[actorKey] : Spawn(actorKey);

                return(Task.FromResult <IActorProxy>(new DelegatingActorProxy(actor.ActorRef, (context, msg) => actor.Process(new OperationContext(context.ReplyChannel, msg, context.ActivityId)),
                                                                              (context, msg) => actor.Process(new OperationContext(context.ReplyChannel, msg, context.ActivityId)), Observable.Never <IActorProxy>())));
            }
        }
        TActor Spawn(ActorKey actorKey)
        {
            lock (_whole)
            {
                var actor = _actorFactory();
                actor.Init(this, new ActorRef(_node.Address, actorKey));

                _actors.Add(actorKey, actor);
                return(actor);
            }
        }
 public Task DisposeActor(ActorKey actorKey)
 {
     lock (_whole)
     {
         TActor actor;
         if (_actors.TryGetValue(actorKey, out actor))
         {
             _actors.Remove(actorKey);
             //TODO: some notification
         }
         return(TaskExt.Done);
     }
 }
Esempio n. 5
0
 public ActorProxy(TNetContract channel, ActorKey key)
 {
     Channel = channel;
     Key     = key;
 }
 public ActorRemoteInfo(string name, ActorKey key)
 {
     Name = name;
     Key  = key;
 }
 public ActorProxyKey(ActorKey actorKey, uint netContractId)
 {
     ActorKey      = actorKey;
     NetContractId = netContractId;
 }