/// <inheritdoc/> public bool Send(string args, string m, out string result) { result = null; try { result = client.Send(args, null); logger.LogDebug($"使用链接:{transport.GetHashCode()}发送数据"); return(true); } catch (Exception ex) { isConnected = false; logger.LogError(ex, $"Thrift.Client.Send.Error,链接:{transport.GetHashCode()}"); return(false); } }
/// <summary> /// 打开一个Thrift 连接 /// </summary> /// <param name="client">连接配置</param> public GrantThriftClient(ClientItem client) { try { clientItem = client; transport = new TSocket(client.Ip, client.Port, client.TimeOut); transport.Open(); this.client = new GrantService.Client(new TBinaryProtocol(transport)); isConnected = true; logger.LogDebug($"创建链接:{transport.GetHashCode()},{client.Ip}:{client.Port},"); } catch (Exception ex) { logger.LogError(ex, "GrantMicroService.GrantRpc.Thrift.Client.RpcClientRegister.Error"); } }