NServiceBus.Azure.Transports.WindowsAzureServiceBus - Duplicated subscriptions with endpoint-oriented topology

azureservicebus

(Sean Feldman) #1

Hi everyone,

In the recent NServiceBus.Azure.Transports.WindowsAzureServiceBus patch releases 9.0.5 and 9.1.2 we have fixed an issue where the legacy transport was creating duplicate subscriptions when upgrading from earlier 9.x versions of the transport. While the patched versions do not create duplicates, there might be duplicated subscriptions in your system that should be removed to avoid potential event overflow.

How to detect duplicates

Duplicated subscriptions will be under <publisher-name>.events topics along with subscriptions that should be in place. Duplicate subscriptions are not actively processed and will accumulate messages.

Warning: prior to removing duplicate subscriptions, subscribing endpoints are up and running, consuming messages. This will help to identify duplicate subscriptions from the valid subscriptions.

Subscriptions with a name longer than 50 characters will be sanitized. Look for both original (<subscriber-name>.<event-name>) and sanitized subscription (result of sanitization method for <subscriber-name>.<event-name>) names.

image

To verify sanitized subscription name stands for the correct subscriber and event, use a tool to inspect subscription’s User Description field. The field should contain information in the format of “subscriber-name> subscribed to <event-full-name>”.

image

Once duplicate subscription is identified and confirmed, it should be removed.

Subscription SQL filter optimization log message

Note: subscriptions rules cannot be modified. To update a rule, a new version has to be created first and the old rule deleted second.

Patched versions of the legacy transport will detect duplicates and log a warning that looks as the following:

2019-03-01 00:00:00.000 INFO NServiceBus.Transport.AzureServiceBus.AzureServiceBusSubscriptionCreatorV6 SQL filter of the existing subscription 'Samples.ASB.Polymorphic.Subscriber.BaseEvent' should be optimized.
Update Rule filter from “[NServiceBus.EnclosedMessageTypes] LIKE 'Events.BaseEvent%' OR [NServiceBus.EnclosedMessageTypes] LIKE '%Events.BaseEvent%' OR [NServiceBus.EnclosedMessageTypes] LIKE '%Events.BaseEvent' OR [NServiceBus.EnclosedMessageTypes] = 'Events.BaseEvent’” to “[NServiceBus.EnclosedMessageTypes] LIKE '%Events.BaseEvent%’”.

This optimization is optional and should be performed with extreme caution to ensure no messages are not lost.

  1. Locate the subscription left after duplicate removal (Samples.ASB.Polymorphic.Subscriber.BaseEvent for the sample above).
  2. Add a new SQL rule to the subscription .
  3. Provide a custom rule a name.
  4. Use SQL filter provided in the log ([NServiceBus.EnclosedMessageTypes] LIKE '%Events.BaseEvent%’).
  5. Save it.
  6. Once the new rule shows up (see image below), the original $Default rule can be removed.

image

For any additional clarifications do not hesitate to contact support at https://particular.net/support.

* A third party tools such as ServiceBus Explorer or Queue Explorer.