orleans icon indicating copy to clipboard operation
orleans copied to clipboard

How to configure stream provider in ClientConfiguration?

Open lucasgodshalk opened this issue 10 years ago • 5 comments

Hi, I'm fairly new to Orleans, so forgive me if I simply missed this in the documentation.

I'm trying to initialize a basic client in a separate process and send a value to a grain. I start up the client and silo, I can create a grain reference on the client and call a method that subscribes the grain to the stream. My issue is that the GrainClient seems unaware of any stream providers. I have the default ClientConfiguration.xml and OrleansConfiguration.xml files included in the client project.

The information I could not find is how a GrainClient discovers stream providers. Is this information provided by the OrleansConfiguration.xml? Or is that information passed from the Orleans cluster? If it's the former, how do I load the information into the GrainClient?

My client code can basically be reduced to this:

GrainClient.Initialize("ClientConfiguration.xml");

var grain = GrainClient.GrainFactory.GetGrain<IBasicGrainInterface>(0);

await grain.DoSubscribe();

var provider = GrainClient.GetStreamProvider("SMSProvider");

var stream = provider.GetStream<int>(new Guid("e335d0c7-ef3f-43fe-9ba8-ab435bee59a1"), "Bogus");

await stream.OnNextAsync(5);

Thanks.

lucasgodshalk avatar Feb 23 '16 16:02 lucasgodshalk

Both OrleansConfiguration.xml and ClientConfiguration.xml need to have "SMSProvider" listed in them. Do you have it there?

sergeybykov avatar Feb 23 '16 22:02 sergeybykov

Thanks, that did it. I was using the ClientConfiguration class as a reference for what information the client needed and I didn't see a property for stream providers (and I don't believe there is a StreamProviders tag in the xml schema file either, so visual studio actually marks it as an invalid tag).

Could one or both of these be updated? I'd be willing to take a stab at changing the ClientConfiguration, but I know little to nothing about xml schema definitions. Is the current stream provider setup going to remain in place for the foreseeable future?

lucasgodshalk avatar Feb 24 '16 15:02 lucasgodshalk

I opened https://github.com/dotnet/orleans/issues/1498 for the xsd issue. If you can contribute a PR for it, that would be great.

Can we close this one now?

sergeybykov avatar Feb 24 '16 18:02 sergeybykov

Yep.

lucasgodshalk avatar Feb 24 '16 18:02 lucasgodshalk

and you can also use programmatic API to add stream provider to the config: ClientConfiguration.RegisterStreamProvider https://github.com/dotnet/orleans/blob/master/src/Orleans/Configuration/ClientConfiguration.cs#L352

gabikliot avatar Feb 25 '16 05:02 gabikliot