Orleans7 custom ClusterClient injection option impossible?
- Dominant language
- C#
- Stars
- 10.9k
- Forks
- 2.1k
- Avg merge
- 13h 56m
- Merged PRs (30d)
- 351
Description
Hello,
We have long using Orleans in our production environment, and in single client (e.g. asp net core API) we had several references to different silo clusters. In previous version we could manually create IClusterClient using ClientBuilder by building it, and then injecting it as we wish. For example we are using 2 separate instances of IClusterClient that are referencing two different and unconnected silo clusters, and injecting it into service collection by name with Autofac container extension:
`containerBuilder.RegisterType().As().Named("Billing");
containerBuilder.Register(c => c.ResolveNamed("Billing").Client).As ().Named("Billing").ExternallyOwned();`
However in Orleans7 there is no such possibility, in fact you are injecting all the services for us, leaving us with no option to do manual injection as seen in `Orleans.DefaultClientServices.AddDefaultServices(IServiceCollection services)`.
In changes list however you do mention that:
_"If you wish to emulate the previous ClientBuilder behavior, you can create a separate HostBuilder and configure it with an Orleans client. "_
Although I don't quite understand what you mean by _"to emulate the previous ClientBuilder behavior"_. If my understanding is correct, and you suggest to call `UseOrleansClient` extension method on two different hosts, then how do we get services from one host's service provider to another one?
Do you have any suggestions on how to implement named injection logic with Orleans7?
Contributor guide
Research direction
Start by reading Orleans.DefaultClientServices.AddDefaultServices(IServiceCollection services), the ClientBuilder migration note, and the UseOrleansClient and HostBuilder entry points mentioned in the issue. Trace how each host creates and exposes its service provider, then determine whether named injection for multiple clients is supported; done means documenting a concrete supported approach or clearly identifying the missing capability.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100