nclient / NClient

:dizzy: NClient is an automatic type-safe .Net HTTP client that allows you to call web service API methods using annotated interfaces or controllers without boilerplate code.
Apache License 2.0
44 stars 11 forks source link

Client-side service discovery #450

Open smolchanovsky opened 2 years ago

smolchanovsky commented 2 years ago

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

Kingmidas74 commented 2 years ago

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 commented 2 years ago

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

Kingmidas74 commented 2 years ago

@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.