Amazon SQS is a message queuing service provided by amazon and it is the one of the oldest services. It helps decoupling microservices, applications etc by acting as a middleware and breaking the tightly coupled environment.
Why use Amazon SQS?
Let’s consider an example of amazon shopping. When we buy any product from amazon we get a confirmation mail from amazon that you have placed your order. There is a possibility that order processing might work in a different server and use different service and message confirmation might work on a different server as well. So if a messaging server goes down client won’t get a confirmation email about his/her order , as both of these services are tightly coupled and purely depended on each other. Hence, To overcome this problem we introduce an intermediate called Message Queue that would stores the message in the queue until the services “B” becomes active again and we use Amazon SQS for implementation.
You might have a question that what if amazon SQS service goes down? Amazon SQS is fully managed service, and amazon gives a commitment that 99.9% of the time you wouldn’t face any downtime, So that’s pretty fair.
Int the above diagram “A” is known as Producer and “B” is know as Consumers. Also , it’s consumers duty to go to the MQ and retrieve the information. After consumer downloaded and used the information they have to delete the message/data.
What if Consumer forgets to delete the message?
If consumer forgets to delete the message than there is a possibility that the same email will be send to the client two or more times and until you delete the message. That’s the reason from the consumer side they either have to delete the message manually or they can use some api or write a program file to delete the message.
That’s pretty much high level about Amazon SQS.
Thanks for reading!