简体   繁体   中英

AWS SQS integration with Spring cloud

I am looking for a simple working demo of integrating Spring cloud to access AWS SQS. I found few samples online but having hard time running this at locally (not on EC2) as its hard to inject required dependencies manually on local run.

Sorry this is a little old, but hopefully it will help someone out there.

I used this example to get my Spring Boot application to receive messages from Amazon SQS. It worked almost perfectly using Spring Boot 1.3 and Spring Framework 4.2, so I won't bother copying what is already written there.

The only thing I did differently was that I put my AWS credentials into my project's .yml file, like so:

# In src/main/resources/application.yml
cloud:
  aws:
    credentials:
      accessKey: ABCDEFGHIJKLMNOPQRSTUVQXYZ
      secretKey: aBigSecretKey
    region:
      auto: true
    stack:
      auto: false

The AmazonSqsAsync client auto-authenticates using these provided properties, so you don't have to worry about any of the steps of the authentication process. All you have to do is drop these properties into the file, and you're good to go :)

Hope this helps.

您可以在此处找到当前 (spring-boot:2.4) 版本的示例Ryanair guides-awspring-localstack-sqs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM