Open
Description
Type of issue
Missing information
Description
I am having a hard time trying to understand broadcast channels from the documentation.
One main source of confusion is this line of code in StockWorker
:
ChannelId channelId = ChannelId.Create(ChannelNames.LiveStockTicker, Guid.Empty);
- There's no explanation of why
Guid.Empty
is used. IsGuid.Empty
the key of the consuming grain? The declaration ofILiveStockGrain
is not in the docs, so it's unclear what the grain's key type is. There's also no code showing how the grain reference was created, so again unclear as to what the key is. - It's not clear where
ChannelNames
comes from, is it a static class not shown in the docs? - The grain doesn't use
ChannelNames.LiveStockTicker
, so what's the relationship here between subscription in the grain, and producer in the background service? - One of the bullet points states
The OnSubscribed method is called when the grain subscribes to the broadcast channel
. It would be good to call out when this is. I assume it's when the grain is activated, and the grain then subscribes 'under-the-hood' due to the mechanism being implicit? - This may be a quirk of the API, but in the
StockWorker
constructor,ChannelNames.LiveStockTicker
is used to get the channel provider, so why does it need to also be specified as part ofChannelId.Create
?
A comparison between Broadcast Channels and Streams (probably in-memory streams as they seem similar to broadcast channels) would be great, as I'm not sure when to use one over the other and the pros and cons.
/cc @ReubenBond
Clarifications to the docs might also help close dotnet/orleans#8292
Page URL
https://learn.microsoft.com/en-us/dotnet/orleans/streaming/broadcast-channel
Content source URL
https://github.com/dotnet/docs/blob/main/docs/orleans/streaming/broadcast-channel.md
Document Version Independent Id
7de240a6-146f-48d8-c652-58f0ff3571db
Article author
Metadata
- ID: e43e2b09-a8fa-e0fa-99a6-42f7d927e106
- Service: dotnet-orleans