public ChannelMessage Handle(ChannelMessage message)
        {
            if (message.Type() != ChannelMessageType.RpcRequest)
            {
                return(message);
            }
            var request = m_MessageEncoder.ToRequest(message);

            RpcResponse  rpcResponse  = null;
            RpcException rpcException = null;

            try
            {
                rpcResponse = m_RpcRequestHandler.Handle(request);
            }
            catch (Exception exception)
            {
                rpcException = new RpcException(request.QueryId, exception);
            }
            try
            {
                if (rpcResponse != null)
                {
                    m_RpcMessageWriter.Write(rpcResponse);
                }
                if (rpcException != null)
                {
                    m_RpcMessageWriter.Write(rpcException);
                }
            }
            catch (ChannelFaultedException)
            {
                // Other components will handle disconnection
            }

            return(null);
        }
예제 #2
0
 public void Write(RpcException exception)
 {
     m_ChannelMessageWriter.Write(m_MessageEncoder.ToChannelMessage(exception));
 }