SQS/SNS Flashcards

1
Q

How do you guarantee that you will process items from a fifo queue in order.

A

You assign the same message id to all messages that need to be processed in fifo order.
When a client retrieves a message from the queue, all messages with that message id will not be visible to any other client. This will allow you to guarantee that messages are processed in the correct order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you configure your queue so that downstream clients can process messages at an appropriate time.

A

Configure a delay (aka a delay queue). I looked up scenarios as to when you would use this and I got a lot of great examples. Example: You have a workflow that sends a message off to get processed by a downstream client. This process will take any where from 1 to 7 mins. Once this is done, you have a lambda that is listening to a queue to do further processing after the other downstream client has finished. You would add a delay from (0 to 900secs aka 15 min) that would keep your message “not visible” until that time. The alternative would be your writing Thread.Waits in your code to wait before you send your messages to the queue. Also, this can be configured at the queue or message level.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are some difference between long and short polling?

A

Long polling polls all the servers and will not return an empty response until the wait time has expired.
Short polling polls a subset of servers and will return an empty response right away.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly