Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient.CreateTopicAsync C# (CSharp) Метод

CreateTopicAsync() публичный Метод

Initiates the asynchronous execution of the CreateTopic operation.
public CreateTopicAsync ( CreateTopicRequest request, System cancellationToken = default(CancellationToken) ) : Task
request Amazon.SimpleNotificationService.Model.CreateTopicRequest Container for the necessary parameters to execute the CreateTopic operation.
cancellationToken System /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. ///
Результат Task
        public Task<CreateTopicResponse> CreateTopicAsync(CreateTopicRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateTopicRequestMarshaller();
            var unmarshaller = CreateTopicResponseUnmarshaller.Instance;

            return InvokeAsync<CreateTopicRequest,CreateTopicResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }

Same methods

AmazonSimpleNotificationServiceClient::CreateTopicAsync ( string name, System cancellationToken = default(CancellationToken) ) : Task
AmazonSimpleNotificationServiceClient::CreateTopicAsync ( CreateTopicRequest request, CreateTopicResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
AmazonSimpleNotificationServiceClient::CreateTopicAsync ( string name, CreateTopicResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void

Usage Example

Пример #1
0
 /// <summary>
 /// Ensures the topic. The call to create topic is idempotent and just returns the arn if it already exists. Therefore there is 
 /// no nee to check then create if it does not exist, as this would be extral calls
 /// </summary>
 /// <param name="topicName">Name of the topic.</param>
 /// <param name="client">The client.</param>
 /// <returns>System.String.</returns>
 private string EnsureTopic(string topicName, AmazonSimpleNotificationServiceClient client)
 {
     _logger.Value.DebugFormat("Topic with name {0} does not exist. Creating new topic", topicName);
     var topicResult = client.CreateTopicAsync(new CreateTopicRequest(topicName)).Result;
     return topicResult.HttpStatusCode == HttpStatusCode.OK ? topicResult.TopicArn : string.Empty;
 }
AmazonSimpleNotificationServiceClient