intermediate

Queue

Use queues for work distribution where each message is claimed by one competing consumer and processing rate can be smoothed.

A queue distributes work so each message is typically processed by one consumer in a competing consumer group. Producers enqueue; consumers pull or receive push; brokers buffer when consumers lag. Ideal for task distribution, load leveling, and decoupling burst traffic.

Trade-off: ordering is often global or per-queue, not per business key unless partitioned; messages may be redelivered.

On interviews: queue versus topic for order fulfillment workers; ack timing and poison message handling.

Common pitfalls: unbounded queue growth hiding consumer failure; ack before processing; no DLQ.

Checklist:

  • Define visibility timeout and ack semantics.
  • Monitor queue depth and age of oldest message.
  • Route poison messages to DLQ with alerts.
  • Size consumers from throughput and SLA.