Condividi tramite


ServiceBusAdministrationClient.CreateTopicAsync Method

Definition

Overloads

CreateTopicAsync(CreateTopicOptions, CancellationToken)

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

CreateTopicAsync(String, CancellationToken)

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

CreateTopicAsync(CreateTopicOptions, CancellationToken)

Source:
ServiceBusAdministrationClient.cs
Source:
ServiceBusAdministrationClient.cs

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

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

Parameters

options
CreateTopicOptions

A TopicProperties object describing the attributes with which the new topic will be created.

cancellationToken
CancellationToken

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

Returns

The TopicProperties of the newly created topic.

Exceptions

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

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.

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.

The options instance is null.

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

  • A topic with the same name exists under the same service namespace. 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

Throws if a topic already exists. TopicProperties for default values of topic properties.

Applies to

CreateTopicAsync(String, CancellationToken)

Source:
ServiceBusAdministrationClient.cs
Source:
ServiceBusAdministrationClient.cs

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

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

Parameters

name
String

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

cancellationToken
CancellationToken

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

Returns

The TopicProperties of the newly created topic.

Exceptions

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

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.

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.

The topic name is null or empty.

The topic name exceeds the maximum allowed length.

The topic 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

  • A topic with the same name exists under the same service namespace. 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

Throws if a topic already exists. TopicProperties for default values of topic properties.

Applies to