In this article we will discuss AWS SQS
Amazon SQS(Simple Queue Service) is a fully managed message queuing service and it can be used for decoupling the application , communication between distributed applications and services.
SQS is distributed queuing system. Messages are not pushed to receivers. Receivers have to poll SQS to receive messages. Messages can be stored in SQS for short duration of time (1 day minimum to maximum 14 days).
Amazon SQS requires no administrative overhead and little configuration. Amazon SQS works on a massive scale, processing billions of messages per day. You can scale the amount of traffic you send to Amazon SQS up or down without any configuration.
Only one receiver can receive the message and the same message can not be received by other receiver.Receiver need to process the message and process messaged will no more appear in the queue.
The AWS SQS (queue) acts as a buffer between the component producing and saving data, and the component receives the data for processing. This means that the queue resolves issues that arise if the producer is producing work faster than the consumer can process it, or if the producer or consumer is only intermittently connected to the network.
Standard queues Vs FIFO queues
Amazon SQS provides two types of message queues:
Standard queues: Standard queues provide maximum throughput, best-effort ordering, and at-least-once delivery. The standard queue is the default queue type in SQS. When using standard queues, we should design our applications to be idempotent so that there is no negative impact when processing the same message more than once.
Use Cases : Standard message queues in many scenarios, as long as your application can process messages that arrive more than once and out of order, for example:
- Decouple live user requests from intensive background work — Let users upload media while resizing or encoding it.
- Allocate tasks to multiple worker nodes — Process a high number of credit card validation requests.
- Batch messages for future processing — Schedule multiple entries to be added to a database.
FIFO queues: FIFO (First-In-First-Out) queues are used for messaging when the order of operations and events exchanged between applications is important, or in situations where we want to avoid processing duplicate messages. FIFO queues guarantee that messages are processed exactly once, in the exact order that they are sent.
Use Cases : where you might use FIFO queues include the following:
- Order Management : E-commerce order management system where order is critical
- Processing Order : Integrating with a third-party systems where events need to be processed in order.Processing user-entered inputs in the order entered
- Two way communication : Communications and networking — Sending and receiving data and information in the same order
- Online Learning : Preventing a student from enrolling in a course before registering for an account and completes the prerequisites.
- Online ticketing system : Where tickets are distributed on a first come first serve basis
SQS is mainly used to decouple applications.