public RemoteServiceCaller(IClientServiceDiscovery serviceDiscovery, IAddressSelector addressSelector, ITransportClientFactory transportClientFactory, ITypeConvertProvider typeConvertProvider, IServiceTokenGetter serviceTokenGetter, ILogger logger, int retryTimes = -1) { _serviceDiscovery = serviceDiscovery; _addressSelector = addressSelector; _transportClientFactory = transportClientFactory; _typeConvertProvider = typeConvertProvider; _serviceTokenGetter = serviceTokenGetter; _logger = logger; _retryTimes = retryTimes; }
public RemoteServiceCaller(IClientServiceDiscovery serviceDiscovery, IAddressSelector addressSelector, ClientSenderFactory clientSenderFactory, IServiceTokenGetter serviceTokenGetter, ILogger logger) { _serviceDiscovery = serviceDiscovery; _addressSelector = addressSelector; _clientSenderFactory = clientSenderFactory; _serviceTokenGetter = serviceTokenGetter; _logger = logger; _middlewares = new Stack <Func <ClientRequestDel, ClientRequestDel> >(); }
public RemoteServiceCaller(IClientServiceDiscovery serviceDiscovery, IAddressSelector addressSelector, ClientSenderFactory clientSenderFactory, IServiceTokenGetter serviceTokenGetter, IJimuDiagnostic jimuApm, ILoggerFactory loggerFactory) { _serviceDiscovery = serviceDiscovery; _addressSelector = addressSelector; _clientSenderFactory = clientSenderFactory; _serviceTokenGetter = serviceTokenGetter; _logger = loggerFactory.Create(this.GetType()); _middlewares = new Stack <Func <ClientRequestDel, ClientRequestDel> >(); _jimuApm = jimuApm; }
public RemoteServiceExecutor(IClientServiceDiscovery serviceDiscovery, IAddressSelector addressSelector, IServiceTokenGetter serviceTokenGetter, ITransportClientFactory transportClientFactory, ITypeConvertProvider typeConvertProvider, ILogger logger, ISerializer serializer, IAuthorizationHandler authorizationHandler = null, ICache <string, List <ServerAddress> > cache = null, int retryTimes = -1) { _serviceDiscovery = serviceDiscovery; _addressSelector = addressSelector; _transportClientFactory = transportClientFactory; _typeConvertProvider = typeConvertProvider; _serviceTokenGetter = serviceTokenGetter; _authorizationHandler = authorizationHandler; _cache = cache; _logger = logger; _retryTimes = retryTimes; _serializer = serializer; }
public static IServiceHostClientBuilder UseToken(this IServiceHostClientBuilder serviceHostBuilder, Func <string> getToken) { serviceHostBuilder.RegisterService(containerBuilder => { containerBuilder.RegisterType <ServiceTokenGetter>().As <IServiceTokenGetter>().SingleInstance(); }); serviceHostBuilder.AddInitializer(componentRegister => { IServiceTokenGetter tokenGetter = componentRegister.Resolve <IServiceTokenGetter>(); tokenGetter.GetToken = getToken; ILogger logger = componentRegister.Resolve <ILogger>(); logger.Info($"[config]get token has been set"); }); return(serviceHostBuilder); }