AWS Java SDK升级后,拒绝连接到SQS队列

时间:2019-01-23 17:15:04

标签: java amazon-sqs aws-sdk

这是我的连接代码:

SqsClient client = SqsClient.builder()
    .region(Region.EU_WEST_1)
    .credentialsProvider(
        StaticCredentialsProvider.create(
            AwsBasicCredentials.create("myAccessKeyId", "myAccessKeySecret")
        )
    )
    .endpointOverride(URI.create("https://sqs.eu-west-1.amazonaws.com/..."))
    .build();
ReceiveMessageRequest rmr = ReceiveMessageRequest.builder()
    .maxNumberOfMessages(1)
    .build();
ReceiveMessageResponse receiveMessageResponse = client.receiveMessage(rmr);
// ...

它与SDK software.amazon.awssdk:sqs到最后一个预览版本(2.0.0-preview-13)都很好。

2.1.0版及更高版本(2.1.x2.2.x2.3.x)开始,相同的代码(和相同的参数)可以编译,但在运行时由于以下错误而失败:

software.amazon.awssdk.services.sqs.model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version. (Service: Sqs, Status Code: 400, Request ID: ...)

返回2.0.0-preview-*,就可以了。

升级SDK版本缺少什么? 队列本身是否需要执行一项操作(我们无权访问Amazon管理:已提供队列)?

0 个答案:

没有答案