How to configure stream provider in ClientConfiguration?
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.
Both OrleansConfiguration.xml and ClientConfiguration.xml need to have "SMSProvider" listed in them. Do you have it there?
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?
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?
Yep.
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