Example #1
0
 public EchoServerActor()
     : base()
 {
     HostDirectoryActor.Register(this);
     DirectoryActor.GetDirectory().Register(this, "EchoServer");
     Become(new EchoServerBehavior());
 }
Example #2
0
        public object GetDeserializedObject(object obj, Type targetType)
        {
            IActor act = (IActor)obj;

            HostDirectoryActor.Register(act);
            // continue
            ActorTag remoteTag = act.Tag;

            return(act);
        }
Example #3
0
 public object GetDeserializedObject(object obj, Type targetType)
 {
     if (obj is IActor act)
     {
         HostDirectoryActor.Register(act);
         ActorTag remoteTag = act.Tag; // dont touch this
         return(act);
     }
     return(obj);
 }
Example #4
0
        public static async Task <string> Stat(IActor sender)
        {
            CheckArg.Actor(sender);

            GetInstance().SendMessage((Action <IActor>)GetInstance().DoStat, sender);

            var task = await HostDirectoryActor.GetInstance()
                       .Receive(ans => { return((ans is IActor) && (sender.Equals(((IActor)ans)))); });

            return(task as string);
        }
Example #5
0
 public ShardDirectoryActor()
     : base()
 {
     fShardList = new Dictionary <string, string>();
     fShardList.Add("LocalHost", ActorServer.GetInstance().FullHost);
     DirectoryActor.GetDirectory().Register(this, "KnownShards");
     HostDirectoryActor.Register(this);
     Become(new Behavior <ShardRequest>(
                t => t is ShardRequest,
                DoProcessShardRequest));
 }
        private void Behavior(IActor msg)
        {
            // get number of actor in directory
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(DirectoryActor.GetDirectory().Stat());
            // get number of actor in queue list
            sb.AppendLine(ActorTask.Stat());
            // get number of actor in hostdirectory
            sb.AppendLine(HostDirectoryActor.GetInstance().GetStat());
            msg.SendMessage(sb.ToString());
            Become(new NullBehaviors());
        }
 public ShardDirectoryActor(ActorServer actorServer)
     : base()
 {
     fShardList = new Dictionary <string, string>
     {
         { "LocalHost", actorServer.FullHost }
     };
     DirectoryActor.GetDirectory().Register(this, "KnownShards");
     HostDirectoryActor.Register(this);
     Become(new Behavior <ShardRequest>(
                t => t is ShardRequest,
                DoProcessShardRequest));
 }
Example #8
0
 private void ProcessMessage(SerialObject aSerial)
 {
     // disco ?
     if ((aSerial.Data != null) && (aSerial.Data.GetType().Equals(typeof(DiscoCommand))))
     {
         // ask directory entries for server
         //actHostDirectory.Register(this);
         DirectoryActor.GetDirectory().Disco(((DiscoCommand)aSerial.Data).Sender);
     }
     else
     {
         // or send to host directory
         HostDirectoryActor.GetInstance().SendMessage(aSerial);
     }
 }
Example #9
0
        public void GetObjectData(object obj, SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info", "SerializationInfo was null");
            }
            IActor act = (IActor)obj;

            HostDirectoryActor.Register(act);
            // continue
            info.SetType(typeof(RemoteSenderActor));
            ActorTag remoteTag = act.Tag;

            info.AddValue("RemoteTag", remoteTag, typeof(ActorTag));
        }
        private void ProcessMessage(object tobeSerial)
        {
            SerialObject aSerial = tobeSerial as SerialObject;

            if (tobeSerial is DataContractObject)
            {
                aSerial = new SerialObject(((DataContractObject)tobeSerial).Data, ((DataContractObject)tobeSerial).Tag);
            }

            // disco ?
            if (aSerial.Data?.GetType().Equals(typeof(DiscoCommand)) == true)
            {
                // ask directory entries for server
                //actHostDirectory.Register(this);
                DirectoryActor.GetDirectory().Disco(((DiscoCommand)aSerial.Data).Sender);
            }
            else
            {
                // or send to host directory
                HostDirectoryActor.GetInstance().SendMessage(aSerial);
            }
        }