NClient icon indicating copy to clipboard operation
NClient copied to clipboard

Client-side service discovery

Open smolchanovsky opened this issue 2 years ago • 3 comments

I would like to be able to implement the client-side service discovery pattern.

smolchanovsky avatar Jul 23 '22 08:07 smolchanovsky

So.. correct me if i'm wrong. Implementation of this feature required an additional optional package like "NClient.ServiceDiscovery" with... i dunno.. something class fit to the next signature

interface IServiceRegistryProvider {
Task DiscoverAsync (IHostProvider hostProvider); //basically scan all instances of remote service (or maybe just read all IPs from config, etc..) 
Task<IResponseContext<TRequest, TResponse>> ExecuteAsync<TRequest, TResponse>(IRequest request, IResiliencePolicy<TRequest, TResponse>? resiliencePolicy, CancellationToken cancellationToken = default); // execute request after load balance process and define most fit instance of remote service.
}

And... we should inject as an optional that class to transport layer somehow. If serviceRegistryProvider is not null then use it

Am I right? I think logic for discovery any instances of remote sevices could be too tangled, so we musn't make this component is required.

Kingmidas74 avatar Sep 03 '22 08:09 Kingmidas74

Well.. I think I'll take this after hostProvider

Kingmidas74 avatar Sep 15 '22 19:09 Kingmidas74

@smolchanovsky

There are two issues (#436 and #438) here that look like they could be combined with #448 and current issue in one new pkg on the code layer and "epic" on the task layer.

Kingmidas74 avatar Sep 15 '22 19:09 Kingmidas74