Integrate Spring Boot application with AWS SNS/SQS using localstack
ฝัง
- เผยแพร่เมื่อ 12 ก.พ. 2024
- In this video, we will see how to integrate a spring boot application with AWS SQS/SNS but in the local environment using localstack. We will create a SNS topic, a SQS queue and create SNS subscription with sqs as the protocol. We will demo how to publish notifications to SNS topic. Demo will also cover pushing/listening messages to/from SQS queue
Github code: github.com/visa2learn/spring-...
Reference links:
aws.amazon.com/sns/
aws.amazon.com/sqs/
docs.aws.amazon.com/sns/lates...
docs.localstack.cloud/overview/
spring.io/projects/spring-clo...
awspring.io/
docs.aws.amazon.com/sns/lates...
#springboot #springcloudaws #localstack #sqs #sns
Thanks for sharing, may I know where the properties defined in application.yaml is referred in the application?
Those are internally used by spring cloud aws as stated in their documentation page
Can I use spring-cloud-aws-sqs dependency instead of starter dependency? But when using that my listener doesn't seem to work. is there is particular reason for using starter dependency?
Yes the starter dependency auto-configures the SQS integration beans. So those objects are created during application startup. If you do not use the starter, you will have to create the beans yourself.
docs.awspring.io/spring-cloud-aws/docs/3.1.0/reference/html/index.html#sqs-integration
can we use multiple consumers and multiple producers using one queue.how to identify that messages these are for one consumer and these are for another consumer
What you can do is use SNS and add multiple SQS as subscribers to this single SNS topic and then add a message filtering in SNS to route the message only to specific queues depending on what the message is. docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html