Amazon SNS到SQS-使用.NET SDK确认订阅

Amazon SNS到SQS-使用.NET SDK确认订阅,.net,amazon-sqs,amazon-ses,amazon-sns,aws-sdk,.net,Amazon Sqs,Amazon Ses,Amazon Sns,Aws Sdk,我正在尝试设置Amazon Ses通知以转到我的SQS队列。 我按照说明创建SQS队列,然后创建SNS主题,并订阅一个到另一个 然而,在管理控制台中,订阅出现“待定确认” 我正在使用.NET AWS SDK,如何确认订阅?或者更好,为什么我要确认?警察说 如果队列的所有者创建了订阅,则订阅 已自动确认,订阅应处于活动状态 几乎立刻 作为所有者,我正在使用我的AWS凭据进行所有API调用,因此我不明白为什么需要确认,但我如何才能确认 private static string Create

我正在尝试设置Amazon Ses通知以转到我的SQS队列。 我按照说明创建SQS队列,然后创建SNS主题,并订阅一个到另一个

然而,在管理控制台中,订阅出现“待定确认”

我正在使用.NET AWS SDK,如何确认订阅?或者更好,为什么我要确认?警察说

如果队列的所有者创建了订阅,则订阅 已自动确认,订阅应处于活动状态 几乎立刻

作为所有者,我正在使用我的AWS凭据进行所有API调用,因此我不明白为什么需要确认,但我如何才能确认

    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;
    }
private静态字符串CreateBounceTopicAndQueue(IAmazonSQS sqsClient,IAmazonSimpleNotificationService snsClient)
{
//1.创建一个名为ses bounces queue的Amazon SQS队列。
CreateQueueResponse CreateQueueResponse=sqsClient.CreateQueue(新建CreateQueueRequest())
{
QueueName=AppGlobal.SesBouncesQueue,
属性=新字典(){
{“ReceiveMessageWaitTimeSeconds”,“20”}
}
});
字符串queueUrl=createQueueResponse.queueUrl;
//2.创建一个名为ses bounces topic的亚马逊SNS主题
CreateTopicResponse CreateTopicResponse=snsClient.CreateTopic(新CreateTopicRequest
{
Name=AppGlobal.sesbuncestopic
});
字符串topicArn=createTopicResponse.topicArn;
//3.配置Amazon SNS主题以发布到SQS队列
var response=snsClient.Subscribe(新SubscriberRequest
{
TopicArn=TopicArn,
端点=队列URL,
协议=“https”
});
返回队列URL;
}

您不能通过使用队列URL创建https订阅来订阅SNS主题的SQS队列

创建一个“sqs”(非https)协议订阅,队列的(非web端点)作为端点





没有清理任何内容,感谢您提供文档主页,好像我不知道它在那里,我自己也链接到了它,不是吗?@议会,我想这一定很烦人,因为我好像以为您不知道文档在哪里,或者根本不想看。我不打算粘贴主页链接。当我复制/粘贴那个URL时,我在我的android上,没有注意到文档网站上的URL,令人烦恼的是,当你浏览它时,它没有改变。更新后的答案中添加了正确的URL和一些引文,我相信你会发现这些都是正确的。。。SNS到SQS要求协议为“SQS”(不是https),端点为队列的ARN,而不是URL。非常感谢您的更正。我很快会试试的。是的,就是这样,再次谢谢。对于将来在调用sesClient.SetIdentityNotificationTopic()时使用SES的绊脚石,请求中的“SnsTopic”也是主题ARN。
protocol
Type: System.String
The protocol you want to use. 
...
sqs -- delivery of JSON-encoded message to an Amazon SQS queue
endpoint
Type: System.String
The endpoint that you want to receive notifications. Endpoints vary by protocol...

For the sqs protocol, the endpoint is the ARN of an Amazon SQS queue