Clarify Orleans Broadcast Channels documentation with missing context and comparisons #49373
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #[issue_number]
Summary
This PR addresses confusion in the Orleans Broadcast Channels documentation by adding missing code snippets, clarifying key concepts, and providing a comprehensive comparison with Orleans Streams.
Changes Made
Added Missing Code Snippets
The documentation now includes two critical code snippets that were previously referenced but not shown:
ILiveStockGraininterface - Shows that the grain usesIGrainWithGuidKey, clarifying the grain's key typeChannelNamesclass - Displays the static class containing the channel name constant used throughout the exampleEnhanced Publisher Section
Added detailed explanations for the
StockWorkerpublisher code:ChannelId.Createparameters: Clarified thatGuid.Emptyis used as the namespace parameter to indicate a single shared broadcast where all subscribers receive all messagesChannelNames.LiveStockTickerappears in bothGetBroadcastChannelProviderandChannelId.Create, and that both must match the name used in silo configurationEnhanced Consumer Section
Improved the consumer grain explanation:
IOnBroadcastChannelSubscribedenables automatic subscription when grains are activatedOnSubscribedtiming: Clarified that this method is called automatically when the grain is activated (first use or after recovery from failure)[ImplicitChannelSubscription]attribute: Highlighted this attribute's role in marking grains for automatic subscriptionAdded Comparison with Orleans Streams
Created a new section comparing Broadcast Channels with Orleans Streams (including in-memory streams):
Validation
ai-usage: ai-assistedfrontmatter as requiredRelated Issue
This PR addresses all points raised in the issue:
Guid.Emptyusage inChannelId.CreateChannelNamesclass sourceILiveStockGraininterface declarationOnSubscribedis calledcc @ReubenBond @IEvangelist
Original prompt
Fixes #39496
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
Internal previews