Beispiel #1
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);
        }
        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());
        }
Beispiel #3
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);
     }
 }
        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);
            }
        }