首页 > 解决方案 > SQS Receiver - Spring Boot

问题描述

I was trying to create a SQS queue listener in my spring boot app using the code below

AmazonSQSAsyncClient amazonSQSAsyncClient= new AmazonSQSAsyncClient(getProfileCredentialsProvider());

However AmazonSQSAsyncClient seems to be deprecated. Is there a different way of using builder to create this object?

标签: javaspringamazon-web-servicesspring-bootspring-messaging

解决方案


How about this?

AmazonSQSAsyncClientBuilder.standard()
                .withCredentials(getProfileCredentialsProvider())
                .build();

That is really mentioned in the JavaDocs:

* @deprecated use {@link AmazonSQSAsyncClientBuilder#withCredentials(AWSCredentialsProvider)}
 */
@Deprecated
public AmazonSQSAsyncClient(AWSCredentialsProvider awsCredentialsProvider) {

推荐阅读