Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use delay queue feature of Amazon SQS?

I understand the concept of delay queue of Amazon SQS, but I wonder why it is useful. What's the usage of SQS delay queue? Thanks

like image 507
elance Avatar asked Aug 12 '14 02:08

elance


People also ask

What is the two types of queues available in Amazon SQS?

SQS offers two types of message queues. Standard queues offer maximum throughput, best-effort ordering, and at-least-once delivery. SQS FIFO queues are designed to guarantee that messages are processed exactly once, in the exact order that they are sent.

What will happen if you set the Amazon SQS message timer delay s parameter to 30 seconds?

So message will be moved to DLQ automatically and then you can consume from DLQ. Both primary queue and DLQ can have max 15 min delay, so finally you get 30 min delay. So your consumer app receives the message after 30 minutes, without adding any custom logic on it.

Which type of Amazon SQS queue provides at least once delivery?

Q: Does Amazon SQS guarantee delivery of messages? Standard queues provide at-least-once delivery, which means that each message is delivered at least once. FIFO queues provide exactly-once processing, which means that each message is delivered once and remains available until a consumer processes it and deletes it.

Which is a valid type of queue in SQS?

The first-in-first-out (FIFO) queue is the type of AWS SQS queue that guarantees order and provides exactly once delivery of messages.


2 Answers

One use case which i can think of is usage in distributed applications which have eventual consistency semantics. The system consuming the message may have an dependency like a co-relation identifier to be available and hence may need to wait for certain guaranteed duration of time before seeing the co-relation data. In this case, it makes sense for the message to be delayed for certain duration of time.

like image 59
Rama Krishna Sanjeeva Avatar answered Oct 12 '22 12:10

Rama Krishna Sanjeeva


Like you I was confused as to a use-case for delay queues, until I stumbled across one in my own work. My application needs to have an internal queue with each item waiting at least one minute between each check for completion.

So instead of having to manage a "last-checked-time" on every object, I just shove the object's ID into an SQS queue messagewith a delay time of 60 seconds, and my main loop then becomes a simple long-poll against the queue.

like image 31
Casirati Avatar answered Oct 12 '22 13:10

Casirati