예제 #1
0
        /// <summary>
        /// client主动获取服务
        /// </summary>
        public void GetMyServer(string fullName = null)
        {
            var result          = new List <ConsulServiceResponse>();
            var serviceFullName = fullName ?? GetServiceFullName();

            if (string.IsNullOrEmpty(serviceFullName))
            {
                _slabLogger.Error("GetMyServer", "get serviceFullName error :" +  Context.ConnectionId);
                Clients.Caller.GetMyServer(result);
            }
            var res = new ServiceRepository();
            var respositoryResult = res.GetServerNodeList(serviceFullName);

            if (respositoryResult.Count < 1)
            {
                _slabLogger.Error("GetMyServer",
                                  "serviceFullName:{0} can not found any server :{1}".Args(serviceFullName, Context.ConnectionId));
            }
            else
            {
                //有服务才加组
                SubscribeGroup(serviceFullName);
            }
            Clients.Caller.GetMyServer(respositoryResult);
        }
예제 #2
0
 protected override void OnIncomingError(ExceptionContext ex, IHubIncomingInvokerContext context)
 {
     _slabLogger.Error("ErrorHandlingPipelineModule.OnIncomingError", "=> Exception " + ex.Error + " " + ex.Result);
     if (ex.Error.InnerException != null)
     {
         _slabLogger.Error("ErrorHandlingPipelineModule.OnIncomingError", "=> Inner Exception " + ex.Error.InnerException.Message);
     }
     base.OnIncomingError(ex, context);
 }