Share via


ServiceBusAdministrationClient.GetRuleAsync Method

Definition

Retrieves a rule from the service namespace.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Messaging.ServiceBus.Administration.RuleProperties>> GetRuleAsync (string topicName, string subscriptionName, string ruleName, System.Threading.CancellationToken cancellationToken = default);
abstract member GetRuleAsync : string * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Messaging.ServiceBus.Administration.RuleProperties>>
override this.GetRuleAsync : string * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Messaging.ServiceBus.Administration.RuleProperties>>
Public Overridable Function GetRuleAsync (topicName As String, subscriptionName As String, ruleName As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of RuleProperties))

Parameters

topicName
String

The name of the topic relative to service bus namespace.

subscriptionName
String

The subscription name the rule belongs to.

ruleName
String

The name of the rule to retrieve.

cancellationToken
CancellationToken

An optional CancellationToken instance to signal the request to cancel the operation.

Returns

RuleProperties containing information about the rule.

Exceptions

The operation times out. The timeout period is initialized through the ServiceBusAdministrationClientOptions class (see Retry property). You may need to increase the value of timeout to avoid this exception if the timeout value is relatively low.

Topic/Subscription/Rule with this name does not exist.

The server is busy. You should wait before you retry the operation.

The topic, subscription, or rule name is null or empty.

The topic, subscription, or rule name exceeds the maximum allowed length.

The topic, subscription, or rule name is otherwise invalid.

Insufficient permission to perform this operation. You should check to ensure that your ServiceBusAdministrationClient has the necessary claims to perform this operation. https://learn.microsoft.com/azure/service-bus-messaging/service-bus-sas#rights-required-for-service-bus-operations

  • The specified entity could not be found. The Reason will be set to MessagingEntityNotFound in this case.
  • The operation timed out. The Reason will be set to ServiceTimeout in this case.
  • The server is busy. You should wait before you retry the operation. The failure reason will be set to ServiceBusy in this case.
  • An internal error or unexpected exception occurs. The failure reason will be set to GeneralError in this case.

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.

Applies to