Class ManagementClient
- Namespace
- Microsoft.Azure.ServiceBus.Management
- Assembly
- Microsoft.Azure.ServiceBus.dll
public class ManagementClient
- Inheritance
-
ManagementClient
- Inherited Members
Constructors
ManagementClient(ServiceBusConnectionStringBuilder, ITokenProvider)
Initializes a new ManagementClient which can be used to perform management opertions on ServiceBus entities.
public ManagementClient(ServiceBusConnectionStringBuilder connectionStringBuilder, ITokenProvider tokenProvider = null)
Parameters
connectionStringBuilder
ServiceBusConnectionStringBuilderServiceBusConnectionStringBuilder having endpoint information.
tokenProvider
ITokenProviderToken provider which will generate security tokens for authorization.
ManagementClient(string)
Initializes a new ManagementClient which can be used to perform management opertions on ServiceBus entities.
public ManagementClient(string connectionString)
Parameters
connectionString
stringNamespace connection string.
ManagementClient(string, ITokenProvider)
Initializes a new ManagementClient which can be used to perform management opertions on ServiceBus entities.
public ManagementClient(string endpoint, ITokenProvider tokenProvider)
Parameters
endpoint
stringFully qualified domain name for Service Bus. Most likely, {yournamespace}.servicebus.windows.net
tokenProvider
ITokenProviderToken provider which will generate security tokens for authorization.
Methods
CloneRequest(HttpRequestMessage)
public static HttpRequestMessage CloneRequest(HttpRequestMessage req)
Parameters
Returns
CloseAsync()
public Task CloseAsync()
Returns
CreateQueueAsync(QueueDescription, CancellationToken)
Creates a new queue in the service namespace with the given name.
public virtual Task<QueueDescription> CreateQueueAsync(QueueDescription queueDescription, CancellationToken cancellationToken = default)
Parameters
queueDescription
QueueDescriptionA QueueDescription object describing the attributes with which the new queue will be created.
cancellationToken
CancellationToken
Returns
- Task<QueueDescription>
The QueueDescription of the newly created queue.
Remarks
Throws if a queue already exists.
Exceptions
- ArgumentNullException
Queue name is null or empty.
- MessagingEntityAlreadyExistsException
A queue with the same nameexists under the same service namespace.
- ServiceBusTimeoutException
The operation times out.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
CreateQueueAsync(string, CancellationToken)
Creates a new queue in the service namespace with the given name.
public virtual Task<QueueDescription> CreateQueueAsync(string queuePath, CancellationToken cancellationToken = default)
Parameters
queuePath
stringThe name of the queue relative to the service namespace base address.
cancellationToken
CancellationToken
Returns
- Task<QueueDescription>
The QueueDescription of the newly created queue.
Remarks
Throws if a queue already exists. QueueDescription for default values of queue properties.
Exceptions
- ArgumentNullException
Queue name is null or empty.
- ArgumentOutOfRangeException
The length of
queuePath
is greater than 260 characters.- MessagingEntityAlreadyExistsException
An entity with the same name exists under the same service namespace.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
CreateRuleAsync(string, string, RuleDescription, CancellationToken)
Adds a new rule to the subscription under given topic.
public virtual Task<RuleDescription> CreateRuleAsync(string topicPath, string subscriptionName, RuleDescription ruleDescription, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe topic path relative to the service namespace base address.
subscriptionName
stringThe name of the subscription.
ruleDescription
RuleDescriptionA RuleDescription object describing the attributes with which the messages are matched and acted upon.
cancellationToken
CancellationToken
Returns
- Task<RuleDescription>
RuleDescription of the recently created rule.
Exceptions
- ArgumentNullException
Subscription or rule description is null.
- MessagingEntityAlreadyExistsException
A subscription with the same name exists under the same service namespace.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
CreateSubscriptionAsync(SubscriptionDescription, RuleDescription, CancellationToken)
Creates a new subscription within a topic with the provided default rule.
public virtual Task<SubscriptionDescription> CreateSubscriptionAsync(SubscriptionDescription subscriptionDescription, RuleDescription defaultRule, CancellationToken cancellationToken = default)
Parameters
subscriptionDescription
SubscriptionDescriptionA SubscriptionDescription object describing the attributes with which the new subscription will be created.
defaultRule
RuleDescriptionA RuleDescription object describing the default rule. If null, then pass-through filter with name DefaultRuleName will be created.
cancellationToken
CancellationToken
Returns
- Task<SubscriptionDescription>
The SubscriptionDescription of the newly created subscription.
Remarks
Throws if a subscription already exists.
Exceptions
- ArgumentNullException
Subscription description is null.
- MessagingEntityAlreadyExistsException
A subscription with the same name exists under the same service namespace.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
CreateSubscriptionAsync(SubscriptionDescription, CancellationToken)
Creates a new subscription within a topic in the service namespace with the given name.
public virtual Task<SubscriptionDescription> CreateSubscriptionAsync(SubscriptionDescription subscriptionDescription, CancellationToken cancellationToken = default)
Parameters
subscriptionDescription
SubscriptionDescriptionA SubscriptionDescription object describing the attributes with which the new subscription will be created.
cancellationToken
CancellationToken
Returns
- Task<SubscriptionDescription>
The SubscriptionDescription of the newly created subscription.
Remarks
Throws if a subscription already exists. Be default, A "pass-through" filter is created for this subscription, which means it will allow all messages to go to this subscription. The name of the filter is represented by DefaultRuleName. CreateSubscriptionAsync(SubscriptionDescription, RuleDescription, CancellationToken) for creating subscription with a different filter.
Exceptions
- ArgumentNullException
Subscription description is null.
- MessagingEntityAlreadyExistsException
A subscription with the same name exists under the same service namespace.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
CreateSubscriptionAsync(string, string, CancellationToken)
Creates a new subscription within a topic in the service namespace with the given name.
public virtual Task<SubscriptionDescription> CreateSubscriptionAsync(string topicPath, string subscriptionName, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe path of the topic relative to the service namespace base address.
subscriptionName
stringThe name of the subscription.
cancellationToken
CancellationToken
Returns
- Task<SubscriptionDescription>
The SubscriptionDescription of the newly created subscription.
Remarks
Throws if a subscription already exists. SubscriptionDescription for default values of subscription properties. Be default, A "pass-through" filter is created for this subscription, which means it will allow all messages to go to this subscription. The name of the filter is represented by DefaultRuleName. CreateSubscriptionAsync(SubscriptionDescription, RuleDescription, CancellationToken) for creating subscription with a different filter.
Exceptions
- ArgumentNullException
Topic path or subscription name is null or empty.
- ArgumentOutOfRangeException
The length of
topicPath
is greater than 260 characters orsubscriptionName
is greater than 50 characters.- MessagingEntityAlreadyExistsException
A subscription with the same name exists under the same service namespace.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
CreateTopicAsync(TopicDescription, CancellationToken)
Creates a new topic in the service namespace with the given name.
public virtual Task<TopicDescription> CreateTopicAsync(TopicDescription topicDescription, CancellationToken cancellationToken = default)
Parameters
topicDescription
TopicDescriptionA TopicDescription object describing the attributes with which the new topic will be created.
cancellationToken
CancellationToken
Returns
- Task<TopicDescription>
The TopicDescription of the newly created topic.
Remarks
Throws if a topic already exists. TopicDescription for default values of topic properties.
Exceptions
- ArgumentNullException
Topic description is null.
- MessagingEntityAlreadyExistsException
A topic with the same name exists under the same service namespace.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
CreateTopicAsync(string, CancellationToken)
Creates a new topic in the service namespace with the given name.
public virtual Task<TopicDescription> CreateTopicAsync(string topicPath, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe name of the topic relative to the service namespace base address.
cancellationToken
CancellationToken
Returns
- Task<TopicDescription>
The TopicDescription of the newly created topic.
Remarks
Throws if a topic already exists. TopicDescription for default values of topic properties.
Exceptions
- ArgumentNullException
Topic name is null or empty.
- ArgumentOutOfRangeException
The length of
topicPath
is greater than 260 characters.- MessagingEntityAlreadyExistsException
A topic with the same name exists under the same service namespace.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
DeleteQueueAsync(string, CancellationToken)
Deletes the queue described by the path relative to the service namespace base address.
public virtual Task DeleteQueueAsync(string queuePath, CancellationToken cancellationToken = default)
Parameters
queuePath
stringThe name of the queue relative to the service namespace base address.
cancellationToken
CancellationToken
Returns
Exceptions
- ArgumentException
queuePath
is empty or null, or path starts or ends with "/".- ArgumentOutOfRangeException
The length of path is greater than 260.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Queue with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
DeleteRuleAsync(string, string, string, CancellationToken)
Deletes the rule described by ruleName
from subscriptionName
under topicPath
./>
public virtual Task DeleteRuleAsync(string topicPath, string subscriptionName, string ruleName, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe name of the topic relative to the service namespace base address.
subscriptionName
stringThe name of the subscription to delete.
ruleName
stringThe name of the rule to delete.
cancellationToken
CancellationToken
Returns
Exceptions
- ArgumentException
Thrown if
topicPath
,subscriptionName
, orruleName
is null, white space empty or not in the right format.- ArgumentOutOfRangeException
The length of topic path is greater than 260 or length of subscription-name/rule-name is greater than 50.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Rule with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
DeleteSubscriptionAsync(string, string, CancellationToken)
Deletes the subscription with the specified topic and subscription name.
public virtual Task DeleteSubscriptionAsync(string topicPath, string subscriptionName, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe name of the topic relative to the service namespace base address.
subscriptionName
stringThe name of the subscription to delete.
cancellationToken
CancellationToken
Returns
Exceptions
- ArgumentException
topicPath
orsubscriptionName
is empty or null, or path starts or ends with "/".- ArgumentOutOfRangeException
The length of topic path is greater than 260 or length of subscription name is greater than 50.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Subscription with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
DeleteTopicAsync(string, CancellationToken)
Deletes the topic described by the name relative to the service namespace base address.
public virtual Task DeleteTopicAsync(string topicPath, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe name of the topic relative to the service namespace base address.
cancellationToken
CancellationToken
Returns
Exceptions
- ArgumentException
topicPath
is empty or null, or path starts or ends with "/".- ArgumentOutOfRangeException
The length of topic path is greater than 260.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Topic with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetQueueAsync(string, CancellationToken)
Retrieves a queue from the service namespace.
public virtual Task<QueueDescription> GetQueueAsync(string queuePath, CancellationToken cancellationToken = default)
Parameters
queuePath
stringThe path of the queue relative to service bus namespace.
cancellationToken
CancellationToken
Returns
- Task<QueueDescription>
QueueDescription containing information about the queue.
Exceptions
- ArgumentException
Thrown if
queuePath
is null, white space empty or not in the right format.- ArgumentOutOfRangeException
The length of queue path is greater than 260.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Queue with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetQueueRuntimeInfoAsync(string, CancellationToken)
Retrieves the runtime information of a queue.
public virtual Task<QueueRuntimeInfo> GetQueueRuntimeInfoAsync(string queuePath, CancellationToken cancellationToken = default)
Parameters
queuePath
stringThe path of the queue relative to service bus namespace.
cancellationToken
CancellationToken
Returns
- Task<QueueRuntimeInfo>
QueueRuntimeInfo containing runtime information about the queue.
Exceptions
- ArgumentException
Thrown if
queuePath
is null, white space empty or not in the right format.- ArgumentOutOfRangeException
The length of queue path is greater than 260.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Queue with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetQueuesAsync(int, int, CancellationToken)
Retrieves the list of queues present in the namespace.
public virtual Task<IList<QueueDescription>> GetQueuesAsync(int count = 100, int skip = 0, CancellationToken cancellationToken = default)
Parameters
count
intThe number of queues to fetch. Defaults to 100. Maximum value allowed is 100.
skip
intThe number of queues to skip. Defaults to 0. Cannot be negative.
cancellationToken
CancellationToken
Returns
- Task<IList<QueueDescription>>
IList<T> containing list of queues.
Remarks
You can simulate pages of list of entities by manipulating count
and skip
.
skip(0)+count(100) gives first 100 entities. skip(100)+count(100) gives the next 100 entities.
Exceptions
- ArgumentOutOfRangeException
If the parameters are out of range.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetRuleAsync(string, string, string, CancellationToken)
Retrieves a rule from the service namespace.
public virtual Task<RuleDescription> GetRuleAsync(string topicPath, string subscriptionName, string ruleName, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe path of the topic relative to service bus namespace.
subscriptionName
stringThe subscription name the rule belongs to.
ruleName
stringThe name of the rule to retrieve.
cancellationToken
CancellationToken
Returns
- Task<RuleDescription>
RuleDescription containing information about the rule.
Remarks
Note - Only following data types are deserialized in Filters and Action parameters - string,int,long,bool,double,DateTime. Other data types would return its string value.
Exceptions
- ArgumentException
Thrown if
topicPath
,subscriptionName
orruleName
is null, white space empty or not in the right format.- ArgumentOutOfRangeException
The length of topic path is greater than 260 or length of subscription-name/rule-name is greater than 50.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Topic/Subscription/Rule with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetRulesAsync(string, string, int, int, CancellationToken)
Retrieves the list of rules for a given subscription in a topic.
public virtual Task<IList<RuleDescription>> GetRulesAsync(string topicPath, string subscriptionName, int count = 100, int skip = 0, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe topic path.
subscriptionName
stringThe subscription for which all the rules need to be retrieved.
count
intThe number of rules to fetch. Defaults to 100. Maximum value allowed is 100.
skip
intThe number of rules to skip. Defaults to 0. Cannot be negative.
cancellationToken
CancellationToken
Returns
- Task<IList<RuleDescription>>
IList<T> containing list of rules.
Remarks
You can simulate pages of list of entities by manipulating count
and skip
.
skip(0)+count(100) gives first 100 entities. skip(100)+count(100) gives the next 100 entities.
Note - Only following data types are deserialized in Filters and Action parameters - string,int,long,bool,double,DateTime.
Other data types would return its string value.
Exceptions
- ArgumentOutOfRangeException
If the parameters are out of range.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetSubscriptionAsync(string, string, CancellationToken)
Retrieves a subscription from the service namespace.
public virtual Task<SubscriptionDescription> GetSubscriptionAsync(string topicPath, string subscriptionName, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe path of the topic relative to service bus namespace.
subscriptionName
stringThe subscription name.
cancellationToken
CancellationToken
Returns
- Task<SubscriptionDescription>
SubscriptionDescription containing information about the subscription.
Exceptions
- ArgumentException
Thrown if
topicPath
,subscriptionName
is null, white space empty or not in the right format.- ArgumentOutOfRangeException
The length of topic path is greater than 260 or length of subscription-name is greater than 50.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Topic or Subscription with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetSubscriptionRuntimeInfoAsync(string, string, CancellationToken)
Retrieves the runtime information of a subscription.
public virtual Task<SubscriptionRuntimeInfo> GetSubscriptionRuntimeInfoAsync(string topicPath, string subscriptionName, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe path of the topic relative to service bus namespace.
subscriptionName
stringThe subscription name.
cancellationToken
CancellationToken
Returns
- Task<SubscriptionRuntimeInfo>
SubscriptionRuntimeInfo containing runtime information about the subscription.
Exceptions
- ArgumentException
Thrown if
topicPath
,subscriptionName
is null, white space empty or not in the right format.- ArgumentOutOfRangeException
The length of topic path is greater than 260 or length of subscription-name is greater than 50.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Topic or Subscription with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetSubscriptionsAsync(string, int, int, CancellationToken)
Retrieves the list of subscriptions present in the topic.
public virtual Task<IList<SubscriptionDescription>> GetSubscriptionsAsync(string topicPath, int count = 100, int skip = 0, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe topic path under which all the subscriptions need to be retrieved.
count
intThe number of subscriptions to fetch. Defaults to 100. Maximum value allowed is 100.
skip
intThe number of subscriptions to skip. Defaults to 0. Cannot be negative.
cancellationToken
CancellationToken
Returns
- Task<IList<SubscriptionDescription>>
IList<T> containing list of subscriptions.
Remarks
You can simulate pages of list of entities by manipulating count
and skip
.
skip(0)+count(100) gives first 100 entities. skip(100)+count(100) gives the next 100 entities.
Exceptions
- ArgumentOutOfRangeException
If the parameters are out of range.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetTopicAsync(string, CancellationToken)
Retrieves a topic from the service namespace.
public virtual Task<TopicDescription> GetTopicAsync(string topicPath, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe path of the topic relative to service bus namespace.
cancellationToken
CancellationToken
Returns
- Task<TopicDescription>
TopicDescription containing information about the topic.
Exceptions
- ArgumentException
Thrown if
topicPath
is null, white space empty or not in the right format.- ArgumentOutOfRangeException
The length of topic path is greater than 260.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Topic with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetTopicRuntimeInfoAsync(string, CancellationToken)
Retrieves the runtime information of a topic.
public virtual Task<TopicRuntimeInfo> GetTopicRuntimeInfoAsync(string topicPath, CancellationToken cancellationToken = default)
Parameters
topicPath
stringThe path of the topic relative to service bus namespace.
cancellationToken
CancellationToken
Returns
- Task<TopicRuntimeInfo>
TopicRuntimeInfo containing runtime information about the topic.
Exceptions
- ArgumentException
Thrown if
topicPath
is null, white space empty or not in the right format.- ArgumentOutOfRangeException
The length of topic path is greater than 260.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- MessagingEntityNotFoundException
Topic with this name does not exist.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
GetTopicsAsync(int, int, CancellationToken)
Retrieves the list of topics present in the namespace.
public virtual Task<IList<TopicDescription>> GetTopicsAsync(int count = 100, int skip = 0, CancellationToken cancellationToken = default)
Parameters
count
intThe number of topics to fetch. Defaults to 100. Maximum value allowed is 100.
skip
intThe number of topics to skip. Defaults to 0. Cannot be negative.
cancellationToken
CancellationToken
Returns
- Task<IList<TopicDescription>>
IList<T> containing list of topics.
Remarks
You can simulate pages of list of entities by manipulating count
and skip
.
skip(0)+count(100) gives first 100 entities. skip(100)+count(100) gives the next 100 entities.
Exceptions
- ArgumentOutOfRangeException
If the parameters are out of range.
- ServiceBusTimeoutException
The operation times out. The timeout period is initialized through the ServiceBusConnection class. You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or an unexpected exception occured.
QueueExistsAsync(string, CancellationToken)
Checks whether a given queue exists or not.
public virtual Task<bool> QueueExistsAsync(string queuePath, CancellationToken cancellationToken = default)
Parameters
queuePath
stringPath of the queue entity to check.
cancellationToken
CancellationToken
Returns
Exceptions
- ArgumentException
Queue path provided is not valid.
- ServiceBusTimeoutException
The operation times out.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
SubscriptionExistsAsync(string, string, CancellationToken)
Checks whether a given subscription exists or not.
public virtual Task<bool> SubscriptionExistsAsync(string topicPath, string subscriptionName, CancellationToken cancellationToken = default)
Parameters
topicPath
stringPath of the topic.
subscriptionName
stringName of the subscription to check.
cancellationToken
CancellationToken
Returns
Exceptions
- ArgumentException
topic or subscription path provided is not valid.
- ServiceBusTimeoutException
The operation times out.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
TopicExistsAsync(string, CancellationToken)
Checks whether a given topic exists or not.
public virtual Task<bool> TopicExistsAsync(string topicPath, CancellationToken cancellationToken = default)
Parameters
topicPath
stringPath of the topic entity to check.
cancellationToken
CancellationToken
Returns
Exceptions
- ArgumentException
topic path provided is not valid.
- ServiceBusTimeoutException
The operation times out.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
UpdateQueueAsync(QueueDescription, CancellationToken)
Updates an existing queue.
public virtual Task<QueueDescription> UpdateQueueAsync(QueueDescription queueDescription, CancellationToken cancellationToken = default)
Parameters
queueDescription
QueueDescriptionA QueueDescription object describing the attributes with which the queue will be updated.
cancellationToken
CancellationToken
Returns
- Task<QueueDescription>
The QueueDescription of the updated queue.
Exceptions
- ArgumentNullException
Queue descriptor is null.
- MessagingEntityNotFoundException
Described queue was not found.
- ServiceBusTimeoutException
The operation times out.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
UpdateRuleAsync(string, string, RuleDescription, CancellationToken)
Updates an existing rule for a topic-subscription.
public virtual Task<RuleDescription> UpdateRuleAsync(string topicPath, string subscriptionName, RuleDescription ruleDescription, CancellationToken cancellationToken = default)
Parameters
topicPath
stringPath of the topic.
subscriptionName
stringName of the subscription.
ruleDescription
RuleDescriptionA RuleDescription object describing the attributes with which the rule will be updated.
cancellationToken
CancellationToken
Returns
- Task<RuleDescription>
The RuleDescription of the updated rule.
Exceptions
- ArgumentNullException
rule descriptor is null.
- MessagingEntityNotFoundException
Described topic/subscription/rule was not found.
- ServiceBusTimeoutException
The operation times out.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
UpdateSubscriptionAsync(SubscriptionDescription, CancellationToken)
Updates an existing subscription under a topic.
public virtual Task<SubscriptionDescription> UpdateSubscriptionAsync(SubscriptionDescription subscriptionDescription, CancellationToken cancellationToken = default)
Parameters
subscriptionDescription
SubscriptionDescriptionA SubscriptionDescription object describing the attributes with which the subscription will be updated.
cancellationToken
CancellationToken
Returns
- Task<SubscriptionDescription>
The SubscriptionDescription of the updated subscription.
Exceptions
- ArgumentNullException
subscription descriptor is null.
- MessagingEntityNotFoundException
Described subscription was not found.
- ServiceBusTimeoutException
The operation times out.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.
UpdateTopicAsync(TopicDescription, CancellationToken)
Updates an existing topic.
public virtual Task<TopicDescription> UpdateTopicAsync(TopicDescription topicDescription, CancellationToken cancellationToken = default)
Parameters
topicDescription
TopicDescriptionA TopicDescription object describing the attributes with which the topic will be updated.
cancellationToken
CancellationToken
Returns
- Task<TopicDescription>
The TopicDescription of the updated topic.
Exceptions
- ArgumentNullException
Topic descriptor is null.
- MessagingEntityNotFoundException
Described topic was not found.
- ServiceBusTimeoutException
The operation times out.
- UnauthorizedAccessException
No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.
- QuotaExceededException
Either the specified size in the description is not supported or the maximum allowable quota has been reached. You must specify one of the supported size values, delete existing entities, or increase your quota size.
- ServerBusyException
The server is busy. You should wait before you retry the operation.
- ServiceBusException
An internal error or unexpected exception occurs.