Integration and Messaging Flashcards
(37 cards)
Describe the Synchronous and Asyncronous application communication patterns
Synchronous - Application to Application
Asynchronous - Application to queue to Application (Event based)
Which model does each of the following services use:
1. SQS
2. SNS
3. Kinesis
SQS - Queue
SNS - Pub/sub
Kinesis - Real-time streaming
What shoulkd be the first service that comes to your mind when you think of decoupling applications?
SQS
What are two properties of the delivery of messages within SQS to consider?
Can have duplicate and out of order messages
Suppose you have configured an SQS queue and have EC2 instances downstream consuming messages. How can you ensure you have enough EC2 instances to handle the throughput of mesasges?
Use an ASG with scaling based on CloudWatch Metric - Queue Length
If you have an EC2 instance in one account that needs to access an SQS queue in the other, what must you create?
A cross account policy attached to the SQS queue
If you want S3 to be able to publish event notifications to SQS queue, what must you do?
Create a cross account policy and attach it to theSQS queue
What is Message Visibility Timeout and what is its default value?
The duration (by default 30 seconds) of which a message becomes invisible to other consumers once it is polled by a consumer
What is a Dead Letter Queue and how can messages be sent there?
It is where messages that have exceeded the MaximumRecieves threashhold are sent
What is the relation between the type of the DLQ and SQS queue?
They must be the same
How are you able to trigger a DLQ message to be returned to the main queue?
By “redriving to source”
What is Long Polling in relation to SQS?
Allow the consumer to “wait” until a message is recieved into the queue after polling. This reduces the number of API calls and decreases latency.
Given the limitation of 256kb of data in a SQS message, how would you send large messages?
Use the SQS extended client (library) which uses an S3 bucket alongside metadata messages in the queue to store large data
What do the following API related methods and paramters do in SQS
1. CreateQueue(MessageRetentionPeriod), DeleteQueue
2. PurgeQueue
3. SendMessage(DelaySeconds), RecieveMessage,DeleteMessage
4. MaxNumberOfMessages
5. RecieveMessageWaitTimeSeconds
6. ChangeMessageVisibility
- Create or delete a queue
- Delete all message in a queue
- Send (with a delay), recieve, or delete a message
- Limit how many messages will be polled at once by consumer
- Long polling
- Change message timeout
Suppose you configure your SQS queue to FIFO, what is the impact on throughput and duplicate message?
Reduced throughput however messages will be in order using MessageGroup ID and deduplicated using DeduplicationID
What are the two methods to determine if a message is a duplicate in SQS FIFO?
- Content based - Uses SHA256 hash of message body
- Deduplication ID - Manually assign an ID
How can you achieve parallel processing of an ordered subset of messages?
Specify common Message Group ID and define a different consumer per ID
What service should you consider if you want to send a single message to multiple consumers? What pattern does this service use?
Consider SNS which uses a Pub/Sub pattern
Describe how a message in SNS works?
- A message is published to an SNS topic
- Consumers that are “subscribed” to that SNS topic get the message
How can you achieve the Fan Out pattern using SNS and SQS? What is one use case?
- Push a message from a producer to an SNS topic
- Message is recieved by the SQS queues that are subscribed to the topic
Usecase: For a single event type and prefix in s3 you can only have one S3 event rule. But what if you want to send the same s3 event to multiple sqs queues? Use fanout
How would you achieve fanout with ordering and deduplication for SNS?
Create a SNS FIFO topic and have multiple subscrbed SQS FIFO queues
What is an easy way to filter through messages in SNS?
Create a filter policy defined in a JSON document
If you hear real time data, what AWS service should you think of?
Kinesis Data Streams
If you hear near-real time data, what AWS service should you think of?
AWS Data Firehose