What is Amazon SNS
Amazon Simple Notification Service is a fully managed messaging service.
It’s a Publisher Subscriber System
Event producer sends a message to one SNS topic
Topic Endpoints:
- Amazon SQS Queue
- Amazon Lambda
- Http/s Webhooks
- Mobile push
- SMS
- EMail
A pattern that comes a lot in exam questions:
- you can subscribe one or more Amazon SQS queues to an Amazon SNS topic
-> Amazon SQS manages the subscription and any necessary permissions
- When you publish a message to a topic, Amazon SNS sends the message to every subscribed queue.
What is SQS
FIFO queue that has been specified as a dead letter queue in the configuration of another standard or
FIFO queue.
- It is used for Messages that are not processed successfully! The Messages that couldn’t be processed will be moved to the Dead Letter Queue.
- The main task of a dead letter queue is handling message failures.
When a message in a standard SQS queue fails to be processed successfully, it is normally returned to the queue for further processing, potentially causing an endless loop of failures. The Dead Letter Queue provides a solution to this problem by allowing you to redirect failed messages to a separate queue for analysis and troubleshooting.
Short polling is the default behavior for SQS.
Short polling returns immediately with any available messages in the queue, up to the maximum number of messages specified in the MaxNumberOfMessages parameter.
Long polling is achieved by specifying a WaitTimeSeconds parameter when calling ReceiveMessage. The value of WaitTimeSeconds determines the maximum time the call can wait for a message to become available.
Short Polling is suitable for high-throughput applications or when you need low-latency message retrieval.
Long Polling is more efficient and cost-effective for low-traffic queues and can help reduce the request rate and empty responses.