AWS SDK for .NET
Developer Guide

Sending and Receiving Notifications From the Cloud Using Amazon Simple Notification Service

The AWS SDK for .NET supports Amazon Simple Notification Service (Amazon SNS), which is a web service that enables applications, end users, and devices to instantly send and receive notifications from the cloud. For more information, see Amazon SNS.

The following example shows how to use the low-level APIs to list accessible topics in Amazon SNS. This example uses the default client constructor which constructs AmazonSimpleNotificationServiceClient with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.

// using Amazon.SimpleNotificationService; // using Amazon.SimpleNotificationService.Model; var client = new AmazonSimpleNotificationServiceClient(); var request = new ListTopicsRequest(); var response = new ListTopicsResponse(); do { response = client.ListTopics(request); foreach (var topic in response.Topics) { Console.WriteLine("Topic: {0}", topic.TopicArn); var subs = client.ListSubscriptionsByTopic( new ListSubscriptionsByTopicRequest { TopicArn = topic.TopicArn }); var ss = subs.Subscriptions; if (ss.Any()) { Console.WriteLine(" Subscriptions:"); foreach (var sub in ss) { Console.WriteLine(" {0}", sub.SubscriptionArn); } } var attrs = client.GetTopicAttributes( new GetTopicAttributesRequest { TopicArn = topic.TopicArn }).Attributes; if (attrs.Any()) { Console.WriteLine(" Attributes:"); foreach (var attr in attrs) { Console.WriteLine(" {0} = {1}", attr.Key, attr.Value); } } Console.WriteLine(); } request.NextToken = response.NextToken; } while (!string.IsNullOrEmpty(response.NextToken));