When working with Service Bus, it is very useful to make a usage of Service Bus Connection String to create SB-entities.
For example, following line of code can be used to create the QueueClient instance which can be used to send and receive messages:
var client = QueueClient.CreateFromConnectionString(connStr, “queuname”);
Connection string looks usually like:
Connection String is very useful, because many information like service bus namespace and all credentials are contained inside of that staring. This enables creation of for example QueueClient in a single line of code.
In general Connection String is consisted of a moniker (sb://..) which includes protocol and URI with namespace. This defines the Endpoints and/or StsEndpoints.
Additionally it contains a number of so called connection properties which describe credentials.
Following picture illustrates the code which extracts all these artifacts inside of Service Bus library.
May 21 2013, 08:14 AM