dotnet / orleans

Cloud Native application framework for .NET
https://docs.microsoft.com/dotnet/orleans
MIT License
10.06k stars 2.03k forks source link

ClientBuilder equivalent for .UseOrleans() #6662

Closed turowicz closed 1 year ago

turowicz commented 4 years ago

It would be very nice to have an extension method for the IHostBuilder that injects IGrainFactory or IClusterClient without hosting the silo. Currently we have to make sure all the network connection plumbing works and inject the client on our own. Something like .UseOrleansClient() would let us configure the ClientBuilder but take away the responsibility of maintaining a connection / reconnecting.

What are your thoughts?

c0nd3v commented 4 years ago

Good idea

ReubenBond commented 4 years ago

I agree, I think this would be beneficial. There are other projects out there which do add support for this today, for example: https://github.com/OrleansContrib/Orleans.MultiClient

I am still willing to have something built in, and I think it would be a good contribution. One requirement: UseOrleans and UseOrleansClient are mutually exclusive (can't have both on the same IServiceCollection or IHostBuilder), so the support must detect that and throw as soon as possible if the user makes that mistake.

turowicz commented 4 years ago

@ReubenBond I will allow myself to submit a PR spike, but please expect that I may need guidance.

turowicz commented 3 years ago

@ReubenBond I got around to finally starting to work on this but after forking the repo I realised you guys are using .NET Framework project. Being on Ubuntu it makes it impossible for me to help unfortunately, as only .NET 5 is available. Unless there is a workaround? Worth trying in Mono?

dpbevin commented 3 years ago

@ReubenBond I'm happy to rekindle this one. Before I get stuck in, what are you thoughts around:

Add vs Use

Based on this article: https://docs.microsoft.com/en-us/dotnet/core/extensions/options-library-authors

Should the method be:

The latter seems to be consistent with UseOrleans but the former seems to be more consistent with the above article.

Overlap with other issue

I'd propose to address https://github.com/dotnet/orleans/issues/7202 at the same time given there's a bit of linkage between these two issues.

turowicz commented 3 years ago

@dpbevin I'd stick with Orlean's convention over the official guideline. This in theory would be refactored to match the guideline all at once when the team gets to it.

turowicz commented 1 year ago

Resolved by 7.0 release