コード例 #1
0
        private IInvoker GetInvoker(IChannel channel, IInvocation inv)
        {
            var isCallBackServiceInvoke = false;
            var isStubServiceInvoke     = false;
            var port = channel.Url.Port;//todo url.localaddress
            var path = inv.GetAttachment(Constants.PathKey);

            isStubServiceInvoke = "true".Equals(inv.GetAttachment(Constants.StubEventKey), StringComparison.OrdinalIgnoreCase);
            if (isStubServiceInvoke)
            {
                port = channel.Url.Port;
            }
            isCallBackServiceInvoke = IsClientSide(channel) && !isStubServiceInvoke;
            if (isCallBackServiceInvoke)
            {
                path = path + "." + inv.GetAttachment(Constants.CallbackServiceKey);
                inv.Attachments.Add(IsCallbackServiceInvoke, "true");
            }

            var serviceKey = ServiceKey(port, path, inv.GetAttachment(Constants.VersionKey),
                                        inv.GetAttachment(Constants.GroupKey));

            Exporters.TryGetValue(serviceKey, out var exporter);
            return(exporter?.GetInvoker());
        }
コード例 #2
0
ファイル: RpcUtils.cs プロジェクト: zhj149/dubbo.net
        public static long GetInvocationId(IInvocation inv)
        {
            var id = inv.GetAttachment(Constants.IdKey);

            long.TryParse(id, out long result);
            return(result);
        }
コード例 #3
0
ファイル: RpcUtils.cs プロジェクト: zhj149/dubbo.net
        public static bool IsOneway(URL url, IInvocation inv)
        {
            bool isOneway;

            if ("false".Equals(inv.GetAttachment(Constants.ReturnKey)))
            {
                isOneway = true;
            }
            else
            {
                isOneway = !url.GetMethodParameter(GetMethodName(inv), Constants.ReturnKey, true);
            }
            return(isOneway);
        }
コード例 #4
0
ファイル: RpcUtils.cs プロジェクト: zhj149/dubbo.net
        public static bool IsAsync(URL url, IInvocation inv)
        {
            bool isAsync;

            if ("true".Equals(inv.GetAttachment(Constants.AsyncKey)))
            {
                isAsync = true;
            }
            else
            {
                isAsync = url.GetMethodParameter(GetMethodName(inv), Constants.AsyncKey, false);
            }
            return(isAsync);
        }