fix: Support multi-transport queue name parsing for MassTransit#3523
fix: Support multi-transport queue name parsing for MassTransit#3523tippmar-nr merged 12 commits intomainfrom
Conversation
MassTransitHelpers.GetQueueData() only understood RabbitMQ-style URIs, causing all other transports (Kafka, Azure Service Bus, SQS, ActiveMQ, In-Memory) to report queue name as "Unknown" with incorrect destination type. Rewrote the parser to be scheme-aware, handling each transport's URI format. Also fixed hardcoded MessageBrokerDestinationType.Queue in the consume path of both modern and legacy NewRelicFilter.
…uration Add MassTransitTestApp project and MassTransit.Kafka/MassTransit.RabbitMQ packages to Dotty tracking. Both packages are pinned to 8.x (9.x requires a paid license) and net8.0 TFM is excluded from updates.
…3519) GetQueueData now accepts an optional fallback URI (DestinationAddress) for when SourceAddress yields Unknown — needed for Kafka Rider where the consume context SourceAddress is the bus endpoint with no queue info. Rider path prefixes (/kafka/, /event-hub/) are detected regardless of the bus transport scheme, so Kafka topics are correctly identified as Topic destination type whether the bus uses RabbitMQ, InMemory, or any other transport.
) New MassTransitTestApp exercises three transports in a single container test: - Kafka Rider: validates Topic destination type and correct topic names - RabbitMQ: validates Queue publish/send/consume through MassTransit filter - InMemory MultiBus: validates loopback:// URI parsing via DI-registered bus Also updates existing MassTransit integration test regex to accommodate the parser change from underscore-split names to full path segments, and adds unit tests for fallback address and Rider prefix detection (49 total).
…-transport-queue-parsing
…-transport-queue-parsing
…compose Aligns with the refactor in main that extracts common service config into docker-compose-base.yml.
MassTransit URI Format Reference for GetQueueData()This document maps each MassTransit transport URI format to its source code in the MassTransit repo and shows how our Agent source: 1. RabbitMQMassTransit source: RabbitMqEndpointAddress.cs Schemes: URI format: Our parsing ( Query params: 2. Kafka RiderMassTransit source: KafkaTopicAddress.cs Scheme: Inherits from host bus (NOT PathPrefix constant: URI format: Examples: Our parsing ( Note: The 3. Azure Event Hubs RiderMassTransit source: EventHubEndpointAddress.cs Scheme: Inherits from host bus PathPrefix constant: URI format: Our parsing ( 4. Azure Service BusMassTransit source: ServiceBusEndpointAddress.cs Scheme: URI format: Our parsing ( Query params: 5. Amazon SQSMassTransit source: AmazonSqsEndpointAddress.cs Scheme: URI format: Our parsing (scheme switch): Extracts last path segment. Checks Query params: 6. ActiveMQMassTransit source: ActiveMqEndpointAddress.cs Schemes: URI format: Default port: 61616 (omitted from URI) Our parsing (scheme switch): Extracts last path segment. Checks Query params: Note on 7. InMemory / LoopbackMassTransit source: InMemoryEndpointAddress.cs Scheme: URI format: Our parsing (scheme switch): Extracts last path segment. No temp queue detection (InMemory doesn't support persistent queues). Query params: 8. SQL TransportMassTransit source: SqlEndpointAddress.cs, SqlHostAddress.cs Scheme: URI format: Our parsing: No explicit Query params: 9. WebJobs TransportsMassTransit source: These are Azure Functions (WebJobs) bindings for Event Hubs and Service Bus. They do not define their own endpoint address classes — they reuse the address classes from their parent transports ( 10. Short-form Addressing (All Transports)MassTransit source: All endpoint address classes support short-form pseudo-schemes. Schemes: URI format: Our parsing (scheme switch, first priority): Detected by scheme before any transport-specific parsing. Verification note: Short-form support was verified in the source for RabbitMQ, ActiveMQ, InMemory, SQS, and Service Bus address classes. It was not independently verified for Kafka or Event Hub address classes. Unknown / Unrecognized URI FormatsBehavior: The Null URI: If Fallback address: Parsing Priority Order
Exhaustive Transport EnumerationAll 10 transports under
No other Rider-style path prefixes exist beyond Known Gaps
|
MassTransit generates rabbitmqs:// URIs for SSL connections to RabbitMQ. Add case "rabbitmqs" fallthrough to ParseRabbitMqUri so these URIs get the underscore-splitting logic instead of falling through to the default last-path-segment extraction.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3523 +/- ##
========================================
Coverage 81.77% 81.77%
========================================
Files 508 508
Lines 34235 34345 +110
Branches 4041 4061 +20
========================================
+ Hits 27995 28086 +91
- Misses 5275 5289 +14
- Partials 965 970 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
nrcventura
left a comment
There was a problem hiding this comment.
It seems like this code should not throw an exception if it encounters a uri with an unexpected format. However, there is a lot of code to wade through, and the explanation from claude describing where the Uri structure is defined, doesn't seem to be accurate, or at least does not seem to be complete enough for me to understand the expected formats. From what I've seen in the MassTransit repo I do not think that this parsing covers all of the possibilities, but I do think that it is an improvement over what was previously there.
Summary
Resolves #3519. MassTransit's Kafka transport (and other non-RabbitMQ transports) reported queue names as
Unknownwith destination typeQueueinstead ofTopic.Root causes:
GetQueueData()only understood RabbitMQ-style underscore-delimited URIsNewRelicFilterusedSourceAddressexclusively, which for Kafka Rider is the bus endpoint (no queue/topic info)MessageBrokerDestinationType.QueueFixes:
GetQueueData()as a scheme-aware parser supporting all MassTransit transports (Kafka, RabbitMQ, Azure Service Bus, Amazon SQS, ActiveMQ, InMemory)DestinationAddresswhenSourceAddressyieldsUnknown— handles Kafka Rider whereSourceAddressis the bus endpoint/kafka/,/event-hub/) regardless of bus transport schemeMessageBrokerDestinationType.Queuein the consume path of both modern and legacyNewRelicFilterTests:
Test plan