public ClientCallInvoker(IEndpointStrategy strategy, string serviceName, int maxRetry = 0, IClientTracer tracer = null) { _strategy = strategy; _serviceName = serviceName; _maxRetry = maxRetry; _tracer = tracer; }
public ClientCallInvoker(IEndpointStrategy strategy, string serviceName, int maxRetry = 0, IClientTracer tracer = null, List <Interceptor> interceptors = null) { _strategy = strategy; _serviceName = serviceName; _maxRetry = maxRetry; _tracer = tracer; _interceptors = interceptors; if (_tracer != null) { _interceptors = _interceptors ?? new List <Interceptor>(); _interceptors.Add(new ClientTracerInterceptor(_tracer)); } }
/// <summary> /// 获取客户端 /// </summary> /// <param name="configPath">配置文件路径</param> /// <param name="tracer">tracer拦截器</param> /// <param name="interceptors">自定义拦截器</param> /// <param name="callInvokers">自定义invoker获取策略</param> /// <returns></returns> public static T Get(string configPath = "", IClientTracer tracer = null, List <Interceptor> interceptors = null, Func <List <ServerCallInvoker>, ServerCallInvoker> callInvokers = null) { var options = new GrpcClientOptions() { Tracer = tracer, ConfigPath = configPath, }; if (interceptors?.Count > 0) { options.Interceptors.AddRange(interceptors); } return(Get(options, callInvokers)); }
public ClientTracerInterceptor(IClientTracer tracer) { _tracer = tracer; }
/// <summary> /// 获取客户端 /// </summary> /// <param name="configPath"></param> /// <param name="tracer"></param> /// <returns></returns> public static T Get(string configPath = "", IClientTracer tracer = null) { var factory = new GrpcClientFactory <T>(tracer); return(_clientCache.GetOrAdd(typeof(T), key => factory.Get(configPath))); }
/// <summary> /// ClientIntercept注入 /// </summary> /// <param name="callInvoker"></param> /// <param name="tracer"></param> /// <returns></returns> public static ServerCallInvoker ClientIntercept(this ServerCallInvoker callInvoker, IClientTracer tracer) { if (callInvoker == null) { return(callInvoker); } return(new InterceptedServerCallInvoker(callInvoker.Channel, tracer)); }
public InterceptedServerCallInvoker(Channel channel, IClientTracer tracer) : base(channel) { _tracer = GrpcPreconditions.CheckNotNull(tracer); }
public GrpcClientFactory(IClientTracer tracer = null) { _tracer = tracer; }
public GrpcClientFactory(IOptions <GrpcClientOptions <T> > options = null, IClientTracer tracer = null) { _options = options?.Value; _tracer = tracer; }
public GrpcClientFactory(IClientTracer tracer = null, List <Interceptor> interceptors = null) { _tracer = tracer; _interceptors = interceptors; }
public GrpcClientFactory(IOptions <GrpcClientOptions <T> > options = null, IClientTracer tracer = null, IOptions <GrpcClientOptions> grpcOptions = null) { _options = options?.Value; _tracer = tracer; _interceptors = grpcOptions?.Value?.Interceptors; }
public InterceptedClientHandler(IClientTracer tracer, ClientInterceptorContext <TRequest, TResponse> context) { _tracer = tracer; _context = context; }