다음을 통해 공유


ManagementClient.CreateSubscriptionAsync Method

Definition

Overloads

CreateSubscriptionAsync(String, String, CancellationToken)

Creates a new subscription within a topic in the service namespace with the given name.

CreateSubscriptionAsync(SubscriptionDescription, RuleDescription, CancellationToken)

Creates a new subscription within a topic with the provided default rule.

CreateSubscriptionAsync(SubscriptionDescription, CancellationToken)

Creates a new subscription within a topic in the service namespace with the given name.

CreateSubscriptionAsync(String, String, CancellationToken)

Source:
ManagementClient.cs

Creates a new subscription within a topic in the service namespace with the given name.

public virtual System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Management.SubscriptionDescription> CreateSubscriptionAsync (string topicPath, string subscriptionName, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateSubscriptionAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Management.SubscriptionDescription>
override this.CreateSubscriptionAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Management.SubscriptionDescription>
Public Overridable Function CreateSubscriptionAsync (topicPath As String, subscriptionName As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of SubscriptionDescription)

Parameters

topicPath
String

The path of the topic relative to the service namespace base address.

subscriptionName
String

The name of the subscription.

cancellationToken
CancellationToken

Returns

The SubscriptionDescription of the newly created subscription.

Exceptions

Topic path or subscription name is null or empty.

The length of topicPath is greater than 260 characters or subscriptionName is greater than 50 characters.

A subscription with the same name exists under the same service namespace.

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.

No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.

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.

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

An internal error or unexpected exception occurs.

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.

Applies to

CreateSubscriptionAsync(SubscriptionDescription, RuleDescription, CancellationToken)

Source:
ManagementClient.cs

Creates a new subscription within a topic with the provided default rule.

public virtual System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Management.SubscriptionDescription> CreateSubscriptionAsync (Microsoft.Azure.ServiceBus.Management.SubscriptionDescription subscriptionDescription, Microsoft.Azure.ServiceBus.RuleDescription defaultRule, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateSubscriptionAsync : Microsoft.Azure.ServiceBus.Management.SubscriptionDescription * Microsoft.Azure.ServiceBus.RuleDescription * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Management.SubscriptionDescription>
override this.CreateSubscriptionAsync : Microsoft.Azure.ServiceBus.Management.SubscriptionDescription * Microsoft.Azure.ServiceBus.RuleDescription * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Management.SubscriptionDescription>
Public Overridable Function CreateSubscriptionAsync (subscriptionDescription As SubscriptionDescription, defaultRule As RuleDescription, Optional cancellationToken As CancellationToken = Nothing) As Task(Of SubscriptionDescription)

Parameters

subscriptionDescription
SubscriptionDescription

A SubscriptionDescription object describing the attributes with which the new subscription will be created.

defaultRule
RuleDescription

A RuleDescription object describing the default rule. If null, then pass-through filter with name DefaultRuleName will be created.

cancellationToken
CancellationToken

Returns

The SubscriptionDescription of the newly created subscription.

Exceptions

Subscription description is null.

A subscription with the same name exists under the same service namespace.

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.

No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.

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.

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

An internal error or unexpected exception occurs.

Remarks

Throws if a subscription already exists.

Applies to

CreateSubscriptionAsync(SubscriptionDescription, CancellationToken)

Source:
ManagementClient.cs

Creates a new subscription within a topic in the service namespace with the given name.

public virtual System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Management.SubscriptionDescription> CreateSubscriptionAsync (Microsoft.Azure.ServiceBus.Management.SubscriptionDescription subscriptionDescription, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateSubscriptionAsync : Microsoft.Azure.ServiceBus.Management.SubscriptionDescription * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Management.SubscriptionDescription>
override this.CreateSubscriptionAsync : Microsoft.Azure.ServiceBus.Management.SubscriptionDescription * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.ServiceBus.Management.SubscriptionDescription>
Public Overridable Function CreateSubscriptionAsync (subscriptionDescription As SubscriptionDescription, Optional cancellationToken As CancellationToken = Nothing) As Task(Of SubscriptionDescription)

Parameters

subscriptionDescription
SubscriptionDescription

A SubscriptionDescription object describing the attributes with which the new subscription will be created.

cancellationToken
CancellationToken

Returns

The SubscriptionDescription of the newly created subscription.

Exceptions

Subscription description is null.

A subscription with the same name exists under the same service namespace.

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.

No sufficient permission to perform this operation. You should check to ensure that your ManagementClient has the correct TokenProvider credentials to perform this operation.

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.

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

An internal error or unexpected exception occurs.

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.

Applies to