Skip to content

LegacyV3NameFormatter.FormatQueueName is not compatibe with Rebus up to 6.0.3 #56

@gaevoy

Description

@gaevoy

LegacyV3NameFormatter.FormatQueueName is not compatible with naming convention of Rebus up to 6.0.3. Same goes to LegacyNameFormatter.

Also it would be nice to specify a version using .UseLegacyNaming(), for instance .UseLegacyNaming(RebusVersion.V6) or .UseLegacyNaming(RebusVersion.V3)

Before 7.x

Queue name: Foo-BAR-1 -> foo-bar-1
https://github.com/rebus-org/Rebus.AzureServiceBus/blob/6.0.7/Rebus.AzureServiceBus/AzureServiceBus/AzureServiceBusTransport.cs#L76

After 7.x

Queue name: Foo-BAR-1 -> foo_bar_1
https://github.com/rebus-org/Rebus.AzureServiceBus/blob/7.1.3/Rebus.AzureServiceBus/AzureServiceBus/AzureServiceBusTransport.cs#L101
https://github.com/rebus-org/Rebus.AzureServiceBus/blob/7.1.3/Rebus.AzureServiceBus/AzureServiceBus/NameFormat/LegacyV3NameFormatter.cs#L14-L22

Workaround

public class LegacyV3NameFormatterFixed : INameFormatter
{
    private static readonly LegacyV3NameFormatter Original = new LegacyV3NameFormatter();

    public string FormatQueueName(string queueName)
    {
        return queueName.ToLowerInvariant();
    }

    public string FormatSubscriptionName(string subscriptionName)
    {
        return Original.FormatSubscriptionName(subscriptionName);
    }

    public string FormatTopicName(string topicName)
    {
        return Original.FormatTopicName(topicName);
    }
}
// boot logic
_activator = new BuiltinHandlerActivator();
Configure.With(_activator)
.Transport(t => t.UseAzureServiceBusAsOneWayClient("...").UseLegacyNaming())
.Options(o => o.Decorate<INameFormatter>(_ => new LegacyV3NameFormatterFixed()))
.Start();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions