Search code examples
javaspringamazon-web-servicesspring-bootspring-messaging

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?


Solution

  • 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) {