Fix PublishAsync with RequireResponse not invoking response handler#2365
Merged
jeremydmiller merged 1 commit intomainfrom Mar 29, 2026
Merged
Fix PublishAsync with RequireResponse not invoking response handler#2365jeremydmiller merged 1 commit intomainfrom
jeremydmiller merged 1 commit intomainfrom
Conversation
When PublishAsync was used with DeliveryOptions.RequireResponse<T>(), the response message arrived back at the sender marked as IsResponse=true. The HandlerPipeline unconditionally routed IsResponse messages to the ReplyTracker, which only has listeners registered by InvokeAsync. Since PublishAsync never registers a listener, the response was dropped with "Unable to find a registered reply listener" error. The fix changes ReplyTracker.Complete() to return bool indicating whether a listener was found. HandlerPipeline now falls through to normal handler execution when no reply listener exists, allowing the response to be handled by a registered message handler as the user expects. Fixes #2360 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Mar 30, 2026
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
Fixes #2360
PublishAsyncis used withDeliveryOptions.RequireResponse<T>(), the response message arrives back at the sender withIsResponse = true. TheHandlerPipelineunconditionally routed allIsResponsemessages to theReplyTracker, which only has listeners registered byInvokeAsync. SincePublishAsyncnever registers a listener, the response was dropped with the error "Unable to find a registered reply listener for conversation id".ReplyTracker.Complete()now returnsboolindicating whether a matching listener was found.HandlerPipelinefalls through to normal handler execution when no reply listener exists, so the response gets handled by the user's registered message handler.InvokeAsynccontinues to work exactly as before since its reply listeners are always registered.Test plan
publish_with_require_response_should_invoke_handlerpasses (verifies handler is called)invoke_async_still_works_for_request_replypasses (regression test)🤖 Generated with Claude Code