Skip Navigation LinksAzure Developers Guide > Azure Service Bus > Brokered Messaging > Managing Messaging Artifacts > NamespaceManager Class

Training Courses

All course material is in English, and courses are delivered in English. Feel free to contact me for further information. cloudcasts.net@gmail.com

NamespaceManager Class

The NamespaceManager class provides management functionality for creating, listing, and deleting messaging artifacts. An instance of the class is initialized for a specific service bus namespace with credentials that allow service bus management operations to be performed.

Constructors

The NamespaceManager class provides four constructors for creating new instances of the class.

 

public NamespaceManager(string address, TokenProvider tokenProvider)

 

public NamespaceManager(Uri address, TokenProvider tokenProvider)

 

public NamespaceManager(string address, NamespaceManagerSettings settings)

 

public NamespaceManager(Uri address, NamespaceManagerSettings settings)

 

 

When choosing a constructor the main choice is weather to supply a TokenProvider or a NamespaceManagerSettings object. The NamespaceManagerSettings class is a simple class that provides a TokenProvider and an OperationTimeout as properties. Choosing the constructors with a NamespaceManagerSettings parameter allows the OperationTimeout to be changed from its default value of 60 seconds. This timeout value controls the timeout for message entity management functions.

Useful Methods

There are a number of methods available for creating and deleting messaging entities and for retrieving information about the entities present in the service bus namespace. The class also provides begin and end implementations for all these methods to allow for asynchronous invocation. Note that there are no methods to update messaging entities, as once they have been created their properties are immutable.

CreateQueue, CreateTopic, CreateSubscription

These methods create messaging entities in the service bus namespace represented by the NamespaceManager. Each method can either take a string as a parameter for the name of the entity, or a description object for the entity. Passing a name will result in default properties being set for the entity, passing a description object will allow the properties to be overridden. These methods all return a description object that contains the properties of the created entity.

DeleteQueue, DeleteTopic, DeleteSubscription

These methods will delete the specified queue, topic or subscription from the service bus namespace. Deleting a topic will also delete all subscriptions associates with that topic.

GetQueue, GetTopic, GetSubscription

These methods return the description class for a messaging entity. The entity is specified by name, and the description class contains the properties of the entity. It should be noted that these methods do not get the actual entity, just the entity properties, which are read-only, and cannot be modified.

GetQueues, GetTopics, GetSubscriptions, GetRules

The GetQueues and GetTopics methods return an enumerable collection of description objects for all the messaging entities of the relevant type in the service bus namespace. GetSubscriptions returns descriptions of all subscriptions in a specified topic. GetRules retunes a description of all the rules in a specified subscription.

QueueExists, TopicExists, SubscriptionExists

These methods return a boolean that specifies if a messaging entity with the specified name exists.

Speaking Engagements