0
0
AWScloud~10 mins

SQS queue concept in AWS - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - SQS queue concept
Message sent by Producer
Message stored in SQS Queue
Message waits in queue until consumed
Consumer polls queue
Message received and processed
Message deleted from queue
End
Messages are sent by producers to the queue, stored until consumers poll and process them, then deleted after processing.
Execution Sample
AWS
SendMessage -> Queue stores message -> ReceiveMessage -> Process -> DeleteMessage
Shows the basic flow of sending, receiving, processing, and deleting a message in SQS.
Process Table
StepActionQueue StateMessage VisibilityResult
1Producer sends message1 message addedVisibleMessage stored in queue
2Consumer polls queue1 message in queueInvisibleMessage received by consumer
3Consumer processes message1 message invisibleInvisibleProcessing in progress
4Consumer deletes message0 messagesN/AMessage removed from queue
5Consumer polls again0 messagesN/ANo messages to receive
💡 Queue empty, no messages left to process
Status Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4Final
Queue Message Count011100
Message VisibilityN/AVisibleInvisibleInvisibleN/AN/A
Key Moments - 3 Insights
Why does the message become invisible after the consumer polls it?
When the consumer polls the message (Step 2), it becomes invisible to other consumers to prevent duplicate processing, as shown in the execution_table row 2.
What happens if the consumer does not delete the message after processing?
If the message is not deleted, it becomes visible again after the visibility timeout, allowing other consumers to receive it, which can cause duplicate processing. This is implied between Steps 3 and 5.
Why does the queue message count remain 1 during processing?
The message stays in the queue until deleted, so during processing (Step 3), the count is still 1 but the message is invisible, as shown in the variable_tracker.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at Step 2, what is the message visibility state?
ADeleted
BVisible
CInvisible
DNot in queue
💡 Hint
Check the 'Message Visibility' column at Step 2 in the execution_table.
At which step does the queue become empty?
AStep 3
BStep 4
CStep 2
DStep 5
💡 Hint
Look at the 'Queue State' column in the execution_table to find when message count is zero.
If the consumer never deletes the message, what would happen at Step 5?
AMessage would become visible again
BQueue would be empty
CMessage would still be invisible
DMessage would be deleted automatically
💡 Hint
Refer to the key_moments explanation about message visibility timeout and deletion.
Concept Snapshot
SQS queue stores messages sent by producers.
Consumers poll messages, which become invisible during processing.
After processing, consumers delete messages to remove them.
If not deleted, messages reappear after visibility timeout.
This ensures reliable, at-least-once delivery.
Full Transcript
Amazon SQS is a message queue service where producers send messages that are stored until consumers poll them. When a consumer receives a message, it becomes invisible to others to avoid duplicate processing. The consumer processes the message and then deletes it from the queue. If the message is not deleted, it becomes visible again after a timeout, allowing reprocessing. This flow ensures messages are reliably delivered and processed.