SQS キューに行くように Amazon Ses 通知をセットアップしようとしています。SQS キューを作成してから SNS トピックを作成し、一方を他方にサブスクライブする方法の指示に従っています。
ただし、管理コンソールでは、サブスクリプションは「保留中の確認」と表示されます。
.NET AWS SDK を使用していますが、サブスクリプションを確認するにはどうすればよいですか? またはさらに良いことに、なぜ確認する必要があるのですか? ドキュメントによると
キューの所有者がサブスクリプションを作成すると、サブスクリプションは自動的に確認され、サブスクリプションはすぐにアクティブになります。
すべての API 呼び出しに所有者として AWS 資格情報を使用しているため、確認する必要がある理由がわかりませんが、とにかくどうすればよいですか?
private static string CreateBounceTopicAndQueue(IAmazonSQS sqsClient, IAmazonSimpleNotificationService snsClient)
{
// 1. Create an Amazon SQS queue named ses-bounces-queue.
CreateQueueResponse createQueueResponse = sqsClient.CreateQueue(new CreateQueueRequest()
{
QueueName = AppGlobal.SesBouncesQueue,
Attributes = new Dictionary<string, string>() {
{ "ReceiveMessageWaitTimeSeconds", "20" }
}
});
string queueUrl = createQueueResponse.QueueUrl;
// 2. Create an Amazon SNS topic named ses-bounces-topic
CreateTopicResponse createTopicResponse = snsClient.CreateTopic(new CreateTopicRequest
{
Name = AppGlobal.SesBouncesTopic
});
string topicArn = createTopicResponse.TopicArn;
// 3. Configure the Amazon SNS topic to publish to the SQS queue
var response = snsClient.Subscribe(new SubscribeRequest
{
TopicArn = topicArn,
Endpoint = queueUrl,
Protocol = "https"
});
return queueUrl;
}