Skip to content

Adds routing key support for rabbitmq#9481

Merged
PascalSenn merged 4 commits intomainfrom
pse/adds-routing-key-support-for-rabbitmq
Mar 29, 2026
Merged

Adds routing key support for rabbitmq#9481
PascalSenn merged 4 commits intomainfrom
pse/adds-routing-key-support-for-rabbitmq

Conversation

@PascalSenn
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 29, 2026 11:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds RabbitMQ topic-exchange routing key support by allowing message types to define a routing key extractor, propagating it via dispatch middleware into the envelope headers, and having the RabbitMQ dispatch endpoint publish with that routing key.

Changes:

  • Introduces a per-MessageType feature collection and wires it up from configuration to runtime.
  • Adds RabbitMQ routing key configuration (UseRabbitMQRoutingKey) + dispatch middleware to set the routing key header.
  • Updates RabbitMQ dispatch to read the routing key header and includes unit + integration tests for routing behavior.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/RabbitMQRoutingKeyTests.cs Unit tests validating extractor storage on MessageType.Features and middleware header behavior.
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/Behaviors/RoutingKeyTests.cs Integration tests verifying topic binding routing and routing-key header propagation.
src/Mocha/src/Mocha/MessageTypes/MessageType.cs Adds Features to MessageType and initializes from configuration features.
src/Mocha/src/Mocha.Transport.RabbitMQ/Topology/Extensions/RabbitMQTransportDescriptorExtensions.cs Registers routing-key dispatch middleware before serialization in RabbitMQ defaults.
src/Mocha/src/Mocha.Transport.RabbitMQ/RabbitMQRoutingKeyExtractor.cs Defines internal feature object for extracting routing keys from messages.
src/Mocha/src/Mocha.Transport.RabbitMQ/RabbitMQRoutingKeyExtensions.cs Adds public descriptor extension to configure routing key extraction per message type.
src/Mocha/src/Mocha.Transport.RabbitMQ/RabbitMQMessageHeaders.cs Adds RoutingKey typed header key constant.
src/Mocha/src/Mocha.Transport.RabbitMQ/RabbitMQDispatchEndpoint.cs Uses the routing key header when publishing to an exchange.
src/Mocha/src/Mocha.Transport.RabbitMQ/Middlewares/Dispatch/RabbitMQRoutingKeyMiddleware.cs Dispatch middleware that writes routing key into dispatch headers when configured.
src/Mocha/src/Mocha.Transport.RabbitMQ/Middlewares/Dispatch/RabbitMQDispatchMiddlewares.cs Exposes a preconfigured dispatch middleware entry for routing key extraction.

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

@github-actions github-actions Bot added the 📚 documentation This issue is about working on our documentation. label Mar 29, 2026
@PascalSenn PascalSenn merged commit 353a205 into main Mar 29, 2026
128 checks passed
@PascalSenn PascalSenn deleted the pse/adds-routing-key-support-for-rabbitmq branch March 29, 2026 17:41
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (6a3b7a3) to head (24bf420).
⚠️ Report is 1056 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #9481       +/-   ##
==========================================
- Coverage   74.16%       0   -74.17%     
==========================================
  Files        2677       0     -2677     
  Lines      140790       0   -140790     
  Branches    16371       0    -16371     
==========================================
- Hits       104421       0   -104421     
+ Misses      30774       0    -30774     
+ Partials     5595       0     -5595     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation This issue is about working on our documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants