Skip to content

Fix late binding of route destinations in mocha#9881

Merged
PascalSenn merged 3 commits into
mainfrom
pse/late-binding-destion-fix
Jun 9, 2026
Merged

Fix late binding of route destinations in mocha#9881
PascalSenn merged 3 commits into
mainfrom
pse/late-binding-destion-fix

Conversation

@PascalSenn

@PascalSenn PascalSenn commented Jun 9, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 9, 2026 22:38
@PascalSenn PascalSenn changed the title pse/late binding destion fix Fix late binding of route destinations Jun 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a routing bug where an outbound route with an explicit destination could be “claimed” by convention-based handler matching (when handlers are explicitly bound), causing sends to go to the conventional endpoint instead of the configured destination queue.

Changes:

  • Added regression tests for RabbitMQ and InMemory ensuring an explicit Send(...To*Queue(...)) destination wins even when the same message type is handled via an explicitly bound endpoint.
  • Updated shared transport lifecycle route discovery to avoid connecting outbound routes that already have an explicit Destination, allowing the build-time destination-connection pass to bind them correctly.
  • Minor cleanup: avoid redundant ConnectEndpoint after ConnectRoute.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/Topology/RabbitMQMessageTypeExtensionTests.cs Adds a regression test asserting Send routes bind to an explicit RabbitMQ queue destination even with explicit handler binding.
src/Mocha/test/Mocha.Transport.InMemory.Tests/InMemoryHandlerClaimTests.cs Adds the equivalent regression test for the InMemory transport.
src/Mocha/src/Mocha/Transport/MessagingTransport.Lifecyle.cs Prevents explicit-destination outbound routes from being claimed during endpoint discovery / handler matching, fixing late-binding behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Mocha/src/Mocha/Transport/MessagingTransport.Lifecyle.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants