Exemplo n.º 1
0
        private static RpcClientProxy GetProxyInner <T>(ServerUri solvedUri, ResolvableUri contextUri)
        {
            RpcClientInterface intf = RpcClientInterfaceFactory <T> .GetOne();

            if (_channels.Count == 0)
            {
                throw new Exception("You *MUST* Register at least 1 client channel at first");
            }

            RpcClientChannel channel;

            if (!_channels.TryGetValue(solvedUri.Protocol, out channel))
            {
                throw new Exception(string.Format("{0} protocol:'{1}' not found", solvedUri.ToString(), solvedUri.Protocol));
            }

            ResolvableUri r    = contextUri as ResolvableUri;
            string        role = r != null ? r.Service : "";
            RpcConnection conn = GetConnection(solvedUri, role);

            RpcClientProxy proxy = new RpcClientProxy(conn, intf, contextUri);

            proxy.Timeout = channel.Timeout;
            return(proxy);
        }
Exemplo n.º 2
0
 internal RpcClientProxy(RpcConnection conn, RpcClientInterface intf, ResolvableUri toUri)
 {
     _conn             = conn;
     _contextUri       = toUri;
     _serviceInterface = intf;
 }