コード例 #1
0
 public object OnRequest(IRequest request)
 {
     if (request.Message is ManagementCommand)
     {
         ManagementCommand command = request.Message as ManagementCommand;
         if (command == null)
         {
             return(null);
         }
         ManagementResponse response = new ManagementResponse();
         response.MethodName = command.MethodName;
         response.Version    = command.CommandVersion;
         response.RequestId  = command.RequestId;
         byte[] arguments = CompactBinaryFormatter.ToByteBuffer(command.Parameters, null);
         try
         {
             response.ResponseMessage = _rpcService.InvokeMethodOnTarget(command.MethodName,
                                                                         command.Overload,
                                                                         GetTargetMethodParameters(arguments)
                                                                         );
             _channel.GetType();
         }
         catch (System.Exception ex)
         {
             response.Exception = ex;
         }
         return(response);
     }
     else
     {
         return(null);
     }
 }
コード例 #2
0
        public object OnRequest(IRequest request)
        {
            if (request.Message is ManagementCommand)
            {
                ManagementCommand command = request.Message as ManagementCommand;

                if (command == null)
                {
                    return(null);
                }
                ManagementResponse response = new ManagementResponse();
                response.MethodName = command.MethodName;
                response.Version    = command.CommandVersion;
                response.RequestId  = command.RequestId;

                // LoggerManager.Instance.SetThreadContext(new LoggerContext() { ShardName = "shard1", DatabaseName = "database" });
                try
                {
                    byte[] arguements = CompactBinaryFormatter.ToByteBuffer(command.Parameters, null);
                    response.ResponseMessage = ManagementProvider.ManagementRpcService.InvokeMethodOnTarget(command.MethodName,
                                                                                                            command.Overload,
                                                                                                            GetTargetMethodParameters(arguements)
                                                                                                            );
                    _channel.GetType();
                }
                catch (System.Exception ex)
                {
                    response.Exception = ex;
                }
                return(response);
            }
            else
            {
                return(null);
            }
        }