Skip to content

How to include a forward slash / in an Azure Service Bus Topic name #2320

@alpachinois

Description

@alpachinois

Description
Azure Service Bus supports hierarchical topic names using / as a separator (e.g. szrmgr/seizurereleasecreatedorupdated). However, Wolverine does not support this naming convention when using ToAzureServiceBusTopic.

Image

Root Cause
In findEndpointByUri, the URI is parsed by segments. When a topic name contains a /, the URI becomes asb://topic/szrmgr/seizurereleasecreatedorupdated which has 3 segments. Wolverine then interprets szrmgr as the topic name and seizurereleasecreatedorupdated as a subscription name, which is incorrect.

case "topic":
    var topicName = uri.Segments[1].TrimEnd('/');
    if (uri.Segments.Length == 3) // slash in topic name triggers this branch incorrectly
    {
        // treated as subscription instead of topic
    }

Steps to Reproduce

opts.PublishMessage<MyEvent>()
    .ToAzureServiceBusTopic("szrmgr/myevent");

Results in Wolverine trying to create a subscription myevent on topic szrmgr instead of using the full topic name szrmgr/myevent.

RequestFailedException: The incoming request is not recognized as a namespace policy put request. To know more visit https://aka.ms/sbResourceMgrExceptions. TrackingId:0cfe7c6a-3e10-4942-9410-8b2aab88b155_G21, SystemTracker:xxxxx.servicebus.windows.net:szrmgr/Subscriptions/myevent, Timestamp:2026-03-18T17:52:44
Status: 404 (Not Found)

Expected Behavior
ToAzureServiceBusTopic("szrmgr/myevent") should publish to the topic literally named szrmgr/myevent.

Workarounds Attempted

  • Using IdentifierPrefix = "szrmgr" — delimiter is . by default in AzureServiceBusTransport, not /
  • Using ToTopic(...) extension method — throws There are no registered topic routed endpoints
  • Using ~, dot as a separator — does not get translated to /

Possible Fix
The findEndpointByUri method could encode the / in the topic name before building the URI, or provide an overload that accepts a raw topic name bypassing URI parsing entirely.

Environment

  • Wolverine version: 5.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions