public static IHostClient CreateHostClient(this GrpcClientFactory factory, string name) { var clientName = ClientName.Host(name); var client = factory.CreateClient <Host.HostClient>(clientName); return(new HostClientWrapper(client)); }
public static IFileSystemClient CreateFileSystemClient(this GrpcClientFactory factory, string name) { var clientName = ClientName.FileSystem(name); var client = factory.CreateClient <FileSystem.FileSystemClient>(clientName); return(new FileSystemClientWrapper(client)); }
public async Task <IActionResult> GetAsync(CancellationToken cancellationToken) { var client = _grpcClientFactory.CreateClient <IGrpcService>(nameof(IGrpcService)); var getServerProcessInfoResponse = await client.GetAsync(new GetServerProcessInfoRequest(), cancellationToken).ConfigureAwait(false); return(PartialView("_ServerProcessInfo", getServerProcessInfoResponse)); }
private async Task ReceiveRequestsAsync(CancellationToken cancellationToken) { try { _logger.LogInformation("Connecting to server to receive requests"); var client = _grpcClientFactory.CreateClient <IGrpcService>(nameof(IGrpcService)); _logger.LogInformation("Created client service"); var requests = client.ReceiveRequestsAsync(cancellationToken); _logger.LogInformation("Connected to server! Listening for incoming requests..."); await ProcessRequests(requests, cancellationToken).ConfigureAwait(false); } catch (Exception e) { _logger.LogCritical(e, "Failed to connect to server to receive requests"); } }
public CitiesClient(GrpcClientFactory grpcClientFactory) { var defaultMethodConfig = new MethodConfig { Names = { MethodName.Default }, RetryPolicy = new RetryPolicy { MaxAttempts = 5, InitialBackoff = TimeSpan.FromSeconds(1), MaxBackoff = TimeSpan.FromSeconds(5), BackoffMultiplier = 1.5, RetryableStatusCodes = { StatusCode.Unavailable } } }; _client = grpcClientFactory.CreateClient <Cities.CitiesClient>(nameof(Cities)); }
//public DemoService(Greeter.GreeterClient client) //{ // //_client = client; //} public DemoService(GrpcClientFactory grpcClientFactory) { _client = grpcClientFactory.CreateClient <Greeter.GreeterClient>("Greeter"); }
public ContactResolver(GrpcClientFactory clientFactory, ILoggerFactory loggerFactory) { _contactClient = clientFactory.CreateClient <ContactApiClient>(nameof(ContactApiClient)); _logger = loggerFactory.CreateLogger <ContactResolver>(); }
public ContactService(GrpcClientFactory clientFactory, ILoggerFactory loggerFactory) : base() { _contactClient = clientFactory.CreateClient <ContactApiClient>(nameof(ContactApiClient)); _logger = loggerFactory.CreateLogger <ContactService>(); }
public LeadService(GrpcClientFactory clientFactory, ILoggerFactory loggerFactory) : base() { _leadClient = clientFactory.CreateClient<LeadApi.Lead.LeadClient>(nameof(Lead.LeadClient)); _logger = loggerFactory.CreateLogger<LeadService>(); }