Runtime: Command Router stream send primitives - #284
Merged
Conversation
Enable progressive IAsyncEnumerable dispatch on the same 1:1 router map without changing non-stream Send/TrySend paths (#282).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
IStreamCommandHandler<TCommand, TItem>,SendStreamAsync/TrySendStreamAsync, and builderRegisterfor stream handlers on the shared 1:1 command map.SendAsync/TrySendAsyncpaths unchanged; referenceMicrosoft.Bcl.AsyncInterfaceson netstandard2.0 forIAsyncEnumerable.Related Issue
Closes #282
Solution module
DesignPatterns/)DesignPatterns.Diagnostics/)DesignPatterns.SourceGenerators/)DesignPatterns.Analyzers/+DesignPatterns.CodeFixes/)DesignPatterns.Extensions.DependencyInjection/)DesignPatterns.Package/)docs/,.github/,AGENTS.md,build/)Note:
Directory.Packages.propsonly adds the centralMicrosoft.Bcl.AsyncInterfacesversion required by the Runtime PackageReference.Type of change
Test plan
./build.ps1 --target Ci --configuration Release(orCiPackif packaging changed)./build.ps1 --target CiBreaking changes
Checklist
CURSOR_SUMMARY, "Made with …")Documentation checklist
Docs for stream capability tracked in #283; generator binding in #265.
Note
Medium Risk
Additive public API on core command routing; behavior mirrors existing send paths, but any custom ICommandRouter implementors must add the new members.
Overview
Adds streaming command dispatch alongside existing void/result routing: new
IStreamCommandHandler<TCommand, TItem>,SendStreamAsync/TrySendStreamAsynconICommandRouter(implemented inCommandRouter), andCommandRouterBuilder.Registerfor stream handlers on the same 1:1 command-type map.Stream routing follows the same rules as
SendAsync/TrySendAsync—missing handlers throw or return failure viaCommandSendAttempt, and calling the wrong overload for a registered contract throwsInvalidOperationException. Only one handler kind per command type (void, result, or stream); docs clarify that pipeline behaviors apply to void/result handlers only.netstandard2.0 gains
Microsoft.Bcl.AsyncInterfacesforIAsyncEnumerable. Unit tests cover progressive yield, cancellation, contract mismatch, duplicate registration, and coexistence with non-stream commands.Reviewed by Cursor Bugbot for commit 0a45b75. Configure here.