Skip to content

Conversation

PieterBlomme
Copy link

In the Azure Service Bus transport, dots are currently replaced by dashes. This should not be the case, since https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules#microsoftservicebus allows dots in queue names (it's possible that the conventions have changed)

I realise dots inside a queue name are probably not best practice, but in our case the queue names are determined by a third party and out of our control.

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.54%. Comparing base (1001431) to head (dfdba33).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2221   +/-   ##
=======================================
  Coverage   81.54%   81.54%           
=======================================
  Files          77       77           
  Lines        9517     9517           
  Branches     1154     1154           
=======================================
  Hits         7761     7761           
  Misses       1564     1564           
  Partials      192      192           

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

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

is this going to be a breaking change?

@PieterBlomme
Copy link
Author

Depends on how a "breaking change" is defined I think, but if a breaking change is defined as a change to the public interface, then I don't think so:

  • Previously dots were replaced by dashes in the queue name inside the internal implementation
  • Having dots in the queue name is already very rare. It's now allowed by Azure naming rules, but it's still an odd thing to do and probably not best practice.
  • Most users are probably unaware of the behaviour. If you allow Kombu to create new queues as needed, you will notice that the queue name in Azure has dashes instead of dots. But it has no impact on the client side.
  • If you do not allow Kombu to create queues (in our case we don't have Manage permissions on the service bus) you will need to make sure to create the service bus queue with the actual name (incl dots) instead of the replaced name (with dashes). Or change the dots to into dashes client side already

So it would only impact users who:

  • Pre-create queues in Azure Service Bus
  • Have dots in the Kombu queue name, but actually expect dashes in their service bus queue name
    I doubt anyone explicitly wants that behaviour. But if they accidentally rely on it, the easy fix is to change dots to dashes whenever specifying the kombu queue.

@auvipy auvipy requested a review from Nusnus January 14, 2025 10:44
Copy link
Member

@Nusnus Nusnus left a comment

Choose a reason for hiding this comment

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

Interesting change. Please rename the PR to a meaningful title.
Also, take note we’re in the middle of a (long) release cycle so this change cannot be merged at least until we finish the release.

Thank you for your patience.

@PieterBlomme PieterBlomme changed the title testcase and fix Allow dots in Azure Service Bus queue names Feb 4, 2025
@PieterBlomme
Copy link
Author

I renamed the PR. No problem if this takes a while to get merged in, we have a workaround on our end

@Nusnus
Copy link
Member

Nusnus commented Feb 4, 2025

I renamed the PR. No problem if this takes a while to get merged in, we have a workaround on our end

Cool. Thank you!

@auvipy auvipy added this to the 5.5.1 milestone Mar 5, 2025
@auvipy auvipy modified the milestones: 5.5.1, 5.7.0 May 8, 2025
@auvipy auvipy requested a review from Copilot June 25, 2025 05:49
Copy link
Contributor

@Copilot 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

This PR updates the Azure Service Bus transport so that queue names can retain dots instead of converting them to dashes.

  • Removed the dot-to-dash mapping in the character replacement table.
  • Adjusted unit tests and comments to assert that dots are allowed in entity names.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
t/unit/transport/test_azureservicebus.py Updated comments and assertions to verify dots are preserved
kombu/transport/azureservicebus.py Removed ord('.')ord('-') mapping in CHARS_REPLACE_TABLE
Comments suppressed due to low confidence (2)

kombu/transport/azureservicebus.py:85

  • Update this comment to reflect that dots are now allowed. For example: 'dots and dashes allowed; all other punctuation replaced by underscore.'
# dots are replaced by dash, all other punctuation replaced by underscore.

t/unit/transport/test_azureservicebus.py:369

  • Add a test case to verify that disallowed punctuation (e.g., '!') is replaced by underscores, for example: assert channel.entity_name('test?celery') == 'test_celery'.
    assert channel.entity_name('test_celery') == 'test_celery'

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants