Skip to content

Allow ServiceBus connection strings to work with EntityPath key#7523

Merged
davidfowl merged 1 commit intomicrosoft:mainfrom
eerhardt:ServiceBusConnectionString
Feb 11, 2025
Merged

Allow ServiceBus connection strings to work with EntityPath key#7523
davidfowl merged 1 commit intomicrosoft:mainfrom
eerhardt:ServiceBusConnectionString

Conversation

@eerhardt
Copy link
Copy Markdown
Member

Description

In the future, the ServiceBus Host integration will append this value to the connection string. This will allow the queue, topic, and subscription names to be specified outside of the application. (Today they are hard-coded in both, or specified separately in config.) We can also add new client APIs to register a Sender or Processor in DI.

Note that the Subscription can be passed in the EntityPath using the format {topic}/Subscriptions/{subscription}.

This is a stop-gap to support these values in .NET Aspire 9.1 client integration so it doesn't break applications when we start adding these values in the future.

Contributes to #7407

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
  • Did you add public API?
    • No
  • Does the change make any security assumptions or guarantees?
    • No
  • Does the change require an update in our Aspire docs?
    • No

In the future, the ServiceBus Host integration will append this value to the connection string. This will allow the queue, topic, and subscription names to be specified outside of the application. (Today they are hard-coded in both, or specified separately in config.) We can also add new client APIs to register a Sender or Processor in DI.

Note that the Subscription can be passed in the EntityPath using the format {topic}/Subscriptions/{subscription}.

This is a stop-gap to support these values in .NET Aspire 9.1 client integration so it doesn't break applications when we start adding these values in the future.

Contributes to microsoft#7407
// The EntityPath can contain a queue or topic name. And if it references a topic,
// it can contain {topic}/Subscriptions/{subscription}. See https://github.com/Azure/azure-sdk-for-net/pull/27070

if (connectionBuilder.TryGetValue("EntityPath", out var _))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can be removed, equivalent to connectionBuilder.Remove("EntityPath"); which returns bool

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In the future we will use the EntityPath value to initialize the queue/topic name, and optionally the subscription name.

@davidfowl davidfowl merged commit aed0a57 into microsoft:main Feb 11, 2025
@eerhardt eerhardt deleted the ServiceBusConnectionString branch February 11, 2025 15:57
@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 10, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants