public static IRpcClientBuilder UserNettyClient <TMessage>(this IRpcClientBuilder builder) where TMessage : InvokeMessage { builder.ConfigureServices((services) => { services.AddSingleton <IClientBootstrap <TMessage>, NettyClientBootstrap <TMessage> >(); }); return(builder); }
public static IRpcClientBuilder AddCore <TMessage>(this IRpcClientBuilder builder) where TMessage : InvokeMessage { builder.ConfigureServices((services) => { services.AddSingleton <ITransportFactory <TMessage>, DefaultTransportFactory <TMessage> >() .AddSingleton <IMessageHandler <TMessage> >(new ClientMessageHandler <TMessage>()) .AddSingleton <IRpcClient <TMessage>, DefaultRpcClient <TMessage> >(); }); return(builder); }
private static IRpcClientBuilder UseDefaultSendRpcRequestStrategy( this IRpcClientBuilder builder) { builder .Builder .UseDefaultSendRpcRequestStrategy ( builder.ApiUrl, builder.ConnectionTimeout, builder.EnableTelemetry ); return(builder); }
public static IRpcClientBuilder AddDefaultEthApi( this IRpcClientBuilder builder) { builder .UseDefaultSendRpcRequestStrategy(); builder .Builder .RegisterType <DefaultEthApiClient>() .As <IEthApiClient>() .SingleInstance() .IfNotRegistered(typeof(IEthApiClient)); return(builder); }
public static IRpcClientBuilder UseServer(this IRpcClientBuilder builder, string remoteAddress) { Preconditions.CheckArgument(!string.IsNullOrEmpty(remoteAddress), "服务器地址不能为空"); builder.UseSetting("DefaultServerAddress", remoteAddress); return(builder); }