Skip to content

Fix PublishAsync with RequireResponse not invoking response handler#2365

Merged
jeremydmiller merged 1 commit intomainfrom
fix-require-response-publish
Mar 29, 2026
Merged

Fix PublishAsync with RequireResponse not invoking response handler#2365
jeremydmiller merged 1 commit intomainfrom
fix-require-response-publish

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

Fixes #2360

  • Root cause: When PublishAsync is used with DeliveryOptions.RequireResponse<T>(), the response message arrives back at the sender with IsResponse = true. The HandlerPipeline unconditionally routed all IsResponse messages to the ReplyTracker, which only has listeners registered by InvokeAsync. Since PublishAsync never registers a listener, the response was dropped with the error "Unable to find a registered reply listener for conversation id".
  • Fix: ReplyTracker.Complete() now returns bool indicating whether a matching listener was found. HandlerPipeline falls through to normal handler execution when no reply listener exists, so the response gets handled by the user's registered message handler.
  • The change is minimal (2 files, ~6 lines of logic) and backward-compatible — InvokeAsync continues to work exactly as before since its reply listeners are always registered.

Test plan

  • New test publish_with_require_response_should_invoke_handler passes (verifies handler is called)
  • New test invoke_async_still_works_for_request_reply passes (regression test)
  • All 1196 CoreTests pass
  • 269/279 RabbitMQ tests pass (10 failures are pre-existing SQL Server connection issues)

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publishing a message with DeliveryOptions.RequireResponse results in error

1 participant