Reputation: 371
I want to use the ServiceBusConnectionStringBuilder to connecto to the Azure Service Bus.
When I enter the connection string generated on Azure to the constructor with one parameter
public ServiceBusConnectionStringBuilder (string connectionString);
the entitypath is null. When I want to create the connection string with the 4 parameter constructor
public ServiceBusConnectionStringBuilder (string endpoint, string entityPath, string sharedAccessKeyName, string sharedAccessKey);
and I enter into entityPath null or an empty string an exception is thrown. The Visual Studio Debugger shows that the values of the both connection string builders are the same.
What should I enter in the entityPath so that the builder is properly executed?
I have no idea since the documentation on this object is missing. Here a link to the documentation page SerbiceBusConnectionStringBuilder Documentation
Upvotes: 8
Views: 9422
Reputation: 1559
As mentioned in the answer by @Stopped Contributing, the entityPath
signifies (and expects) the topic/queue/subscription information within a service bus.
The two constructors that you have mentioned would both give a serviceBusConnectionStringBuilder
instance however they are meant to serve in two different scenarios.
The constructor with one parameter is meant for constructing a builder
instance that can enable connection to a service bus and/or to one or more of the entities that it has (based on the information in the connection string and the access policies of the entities within the service bus)
The constructor with four parameters is meant for constructing a builder instance for an entity (topic/queue or subscription
) of a service bus specifically by virtue of the path to that entity
and the sharedAccessKeyName
& the sharedAccessKeyValue
for that entity.
Hence the exception that is thrown on passing null
or empty string
for entityPath
in the constructor with four parameters.
Upvotes: 1
Reputation: 136306
What should I enter in the entityPath so that the builder is properly executed?
It should be the name of the entity. In case of a Queue or Topic, it should be the name of that Queue or Topic respectively. In case of a Subscription, it should be the path of the Subscription in <topic-name>/subscriptions/<subscription-name>
format.
If you're accessing deadletter queue, simply append /$DeadLetterQueue
to the path from above.
Upvotes: 4