Example #1
0
        private void OnRMI(Message message, Protocols.RMIMessage rmimsg)
        {
            if (!string.IsNullOrEmpty(rmimsg.DeserializeError))
            {
                message.Reply(new Protocols.Error() { Message = rmimsg.DeserializeError });
            }
            else
            {
                RInterfaceInfo interfaceinfo = null;
                RMethodInfo methodinfo = null;
                RInterfaceFactory.Default.TryGet(rmimsg.Name, out interfaceinfo);
                interfaceinfo.TryGet(rmimsg.Method, out methodinfo);
                //Node.Loger.Process(LogType.DEBUG, "{0}.{1} invoke", rmimsg.Name, rmimsg.Method);
                RMethodResult result = methodinfo.Invoke(rmimsg.Parameters);

                if (result.Exception != null)
                {
                    Protocols.Error error = new Protocols.Error() { Message = result.Exception.Message, StackTrace = result.Exception.StackTrace };
                    message.Reply(error);
                    //Node.Loger.Process(LogType.DEBUG, "{0}.{1} invoke error {2}", rmimsg.Name, rmimsg.Method, result.Exception.Message);
                }
                else
                {
                    if (result.IsVoid || result.Value == null)
                        message.Reply(new Protocols.Success());
                    else
                        message.Reply(result.Value);
                    //Node.Loger.Process(LogType.DEBUG, "{0}.{1} invoke completed!", rmimsg.Name, rmimsg.Method);
                }
            }
        }
Example #2
0
 public bool TryGet(string key, out RInterfaceInfo info)
 {
     return(mInterfaces.TryGetValue(key, out info));
 }