public async Task DeleteTopicAsync() { // Snippet: DeleteTopicAsync(string,CallSettings) // Additional: DeleteTopicAsync(string,CancellationToken) // Create client PublisherClient publisherClient = PublisherClient.Create(); // Initialize request argument(s) string formattedTopic = PublisherClient.FormatTopicName("[PROJECT]", "[TOPIC]"); // Make the request await publisherClient.DeleteTopicAsync(formattedTopic); // End snippet }
public async Task DeleteTopicAsync() { // Snippet: DeleteTopicAsync(TopicName,CallSettings) // Additional: DeleteTopicAsync(TopicName,CancellationToken) // Create client PublisherClient publisherClient = await PublisherClient.CreateAsync(); // Initialize request argument(s) TopicName topic = new TopicName("[PROJECT]", "[TOPIC]"); // Make the request await publisherClient.DeleteTopicAsync(topic); // End snippet }
public async Task DeleteTopicAsync_RequestObject() { // Snippet: DeleteTopicAsync(DeleteTopicRequest,CallSettings) // Create client PublisherClient publisherClient = await PublisherClient.CreateAsync(); // Initialize request argument(s) DeleteTopicRequest request = new DeleteTopicRequest { TopicAsTopicName = new TopicName("[PROJECT]", "[TOPIC]"), }; // Make the request await publisherClient.DeleteTopicAsync(request); // End snippet }
public async Task DeleteTopicAsync() { string projectId = _fixture.ProjectId; string topicId = _fixture.CreateTopicId(); await PublisherClient.Create().CreateTopicAsync(new TopicName(projectId, topicId)); // Snippet: DeleteTopicAsync(TopicName,CallSettings) // Additional: DeleteTopicAsync(TopicName,CancellationToken) PublisherClient client = PublisherClient.Create(); TopicName topicName = new TopicName(projectId, topicId); await client.DeleteTopicAsync(topicName); Console.WriteLine($"Deleted {topicName}"); // End snippet }
public async Task DeleteTopic() { if (_logger.IsEnabled(LogLevel.Debug)) { _logger.LogDebug("Deleting Google PubSub topic: {TopicId}", TopicName.TopicId); } try { await _publisher?.DeleteTopicAsync(TopicName); _logger.LogInformation((int)GoogleErrorCode.Initializing, "Deleted Google PubSub topic {TopicId}", TopicName.TopicId); } catch (Exception exc) { ReportErrorAndRethrow(exc, "DeleteTopic", GoogleErrorCode.DeleteTopic); } }
public async Task DeleteTopic() { if (_logger.IsVerbose2) { _logger.Verbose2("Deleting Google PubSub topic: {0}", TopicName.TopicId); } try { await _publisher?.DeleteTopicAsync(TopicName); _logger.Info((int)GoogleErrorCode.Initializing, "Deleted Google PubSub topic {0}", TopicName.TopicId); } catch (Exception exc) { ReportErrorAndRethrow(exc, "DeleteTopic", GoogleErrorCode.DeleteTopic); } }
public async Task DeleteTopicAsync() { string projectId = _fixture.ProjectId; string topicId = _fixture.CreateTopicId(); await PublisherClient.Create().CreateTopicAsync(PublisherClient.FormatTopicName(projectId, topicId)); // Snippet: DeleteTopicAsync(string,CallSettings) // Additional: DeleteTopicAsync(string,CancellationToken) PublisherClient client = PublisherClient.Create(); // Alternative: use a known topic resource name // "projects/{PROJECT_ID}/topics/{TOPIC_ID}" string topicName = PublisherClient.FormatTopicName(projectId, topicId); await client.DeleteTopicAsync(topicName); Console.WriteLine($"Deleted {topicName}"); // End snippet }