-
Notifications
You must be signed in to change notification settings - Fork 162
Correct the description of connection names in the Azure Service Bus client integration. #4720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Correct the description of connection names in the Azure Service Bus client integration. #4720
Conversation
@eerhardt you might want to check my wording? Thanks! |
> The `connectionName` parameter must match the name used when adding the Service Bus resource in the AppHost project. In other words, when you call `AddAzureServiceBus` and provide a name of `messaging` that same name should be used when calling `AddAzureServiceBusClient`. For more information, see [Add Azure Service Bus resource](#add-azure-service-bus-resource). | ||
> The correct `connectionName` parameter depends on your AppHost code: | ||
> | ||
> - If you subscribed to a topic in the AppHost, then the `connectionString` you pass to `AddAzureServiceBusClient()` must match the name you passed to `AddServiceBusSubscription()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't correct. What matters is what object you passed into .WithReference
to your project.
var serviceBus = builder.AddAzureServiceBus("messaging");
var topic = serviceBus.AddServiceBusTopic("myTopic");
builder.AddProject<Projects.WebApplication>("web")
.WithReference(serviceBus); // since `serviceBus` was passed, you use "messaging" in your app
// vs.
builder.AddProject<Projects.WebApplication>("web")
.WithReference(topic); // since `topic` was passed, you use "myTopic" in your app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think that's clear, but my impression from Discord is that a pattern like this is confusing some devs:
var serviceBus = builder.AddAzureServiceBus("messaging").AddServiceBusTopic("myTopic");
builder.AddProject<Projects.WebApplication>("web")
.WithReference(serviceBus);
In other words, they pass serviceBus
to the project, so they wrongly expect a connection string named "messaging" but they get one called "myTopic". Then the type of serviceBus
might also surprise them!
I think I'll correct the wording in this PR, and then raise a separate issue to clear up this potential problem and discourage calling AddXXX
methods on the same line unless fully aware of the consequences. It applies to all integrations so I'll probably put it in the integrations overview article.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification!
Summary
The correct
connectionName
to pass toAddAzureServiceBusClient()
depends on whether you subscribed to a topic in the AppHost.AddServiceBusSubscription()
AddAzureServiceBus()
Fixes #4718
Internal previews