ServiceBusRuleManager.CreateRuleAsync Method

Definition

Overloads

CreateRuleAsync(CreateRuleOptions, CancellationToken)

Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.

CreateRuleAsync(String, RuleFilter, CancellationToken)

Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.

CreateRuleAsync(CreateRuleOptions, CancellationToken)

Source:
ServiceBusRuleManager.cs

Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.

public virtual System.Threading.Tasks.Task CreateRuleAsync (Azure.Messaging.ServiceBus.Administration.CreateRuleOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateRuleAsync : Azure.Messaging.ServiceBus.Administration.CreateRuleOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.CreateRuleAsync : Azure.Messaging.ServiceBus.Administration.CreateRuleOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function CreateRuleAsync (options As CreateRuleOptions, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

options
CreateRuleOptions

The options for the rule to add.

cancellationToken
CancellationToken

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

Returns

A task instance that represents the asynchronous add rule operation.

Exceptions

  • A rule with the same name exists under the subscription. The Reason will be set to MessagingEntityAlreadyExists in this case.
  • The operation timed out. The Reason will be set to ServiceTimeout in this case.
  • Either the specified size of the entity 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. The failure reason will be set to QuotaExceeded 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

You can add rules to the subscription that decides which messages from the topic should reach the subscription. A default TrueRuleFilter rule named DefaultRuleName is always added while creation of the Subscription. You can add multiple rules with distinct names to the same subscription. Multiple filters combine with each other using logical OR condition. i.e., If any filter succeeds, the message is passed on to the subscription.

Applies to

CreateRuleAsync(String, RuleFilter, CancellationToken)

Source:
ServiceBusRuleManager.cs

Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.

public virtual System.Threading.Tasks.Task CreateRuleAsync (string ruleName, Azure.Messaging.ServiceBus.Administration.RuleFilter filter, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateRuleAsync : string * Azure.Messaging.ServiceBus.Administration.RuleFilter * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.CreateRuleAsync : string * Azure.Messaging.ServiceBus.Administration.RuleFilter * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function CreateRuleAsync (ruleName As String, filter As RuleFilter, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

ruleName
String

Name of the rule

filter
RuleFilter

The filter expression against which messages will be matched.

cancellationToken
CancellationToken

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

Returns

A task instance that represents the asynchronous add rule operation.

Exceptions

  • A rule with the same name exists under the subscription. The Reason will be set to MessagingEntityAlreadyExists in this case.
  • The operation timed out. The Reason will be set to ServiceTimeout in this case.
  • Either the specified size of the entity 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. The failure reason will be set to QuotaExceeded 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

You can add rules to the subscription that decides which messages from the topic should reach the subscription. A default TrueRuleFilter rule named DefaultRuleName is always added while creation of the Subscription. You can add multiple rules with distinct names to the same subscription. Multiple filters combine with each other using logical OR condition. i.e., If any filter succeeds, the message is passed on to the subscription.

Applies to