Reputation: 437
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.
Upvotes: 1
Views: 823
Reputation: 3698
you could find a sample with current(spring-boot:2.4) version here Ryanair guides-awspring-localstack-sqs
Upvotes: 0
Reputation: 1637
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.
Upvotes: 1