orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Orleans7 custom ClusterClient injection option impossible?

Open grendizeras opened this issue 1 year ago • 3 comments

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<ClusterClientHostService>().As<IHostedService>().Named<ClusterClientHostService>("Billing"); containerBuilder.Register(c => c.ResolveNamed<ClusterClientHostService>("Billing").Client).As<IClusterClient> ().Named<IClusterClient>("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?

grendizeras avatar Dec 07 '22 16:12 grendizeras