Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orleans Broadcast Channels - Relationship between publisher and consumer is unclear #39496

Open
michaelmcneilnet opened this issue Feb 13, 2024 · 2 comments

Comments

@michaelmcneilnet
Copy link
Contributor

michaelmcneilnet commented Feb 13, 2024

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. Is Guid.Empty the key of the consuming grain? The declaration of ILiveStockGrain 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 of ChannelId.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

@IEvangelist

Metadata

  • ID: e43e2b09-a8fa-e0fa-99a6-42f7d927e106
  • Service: dotnet-orleans
@Neftedollar
Copy link

Agree. I tryed it. And it looks like it doesn't works

@TimoSchmechel
Copy link

+1

the documentation for Broadcasting Streams is very confusing/misleading. The existence of the GUID in the channel ID seems to indicate this channel will only send to a grain with that specific key which is counter intuitive to the word "Broadcast"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants