Message Queues

= durable component, stored in memory, that supports asynchronous communication. Helps reduce request times for expensive operations that would otherwise be performed in-line. Receives, holds, and delivers messages.

If an operation is too slow to perform inline, you can use a message queue with the following workflow:

  • An application publishes a job to the queue, then notifies the user of job status.

  • A worker picks up the job from the queue, processes it, then signals the job is complete.

e.g. RabbitMQ, Amazon SQS

SQS

  • supports dead-letter queues (DLQ) - useful for debugging your application or messaging system because they let you isolate unconsumed messages to determine why their processing doesn't succeed.

  • supports visibility timeout - When a consumer receives and processes a message from a queue, the message remains in the queue. SQS doesn't automatically delete the message, the consumer needs to. To prevent other consumers from processing the message again, SQS sets a visibility timeout, a period of time during which Amazon SQS prevents all consumers from receiving and processing the message. - a message is hidden only after it is consumed from the queue.

  • supports delay queues - let you postpone the delivery of new messages to consumers for a number of seconds - a message is hidden when it is first added to queue

Last updated