Decouple services, buffer load spikes, and enable async workflows
Queues act as a buffer between producers and consumers. When consumers are slower than producers, the queue absorbs the spike. This prevents cascading failures under load.
When producers outpace consumers, queue depth grows. Tune consumer count or processing speed. Consumer lag = number of messages waiting. High lag means consumers are falling behind — scale out or optimize processing.
When a message fails processing repeatedly (network error, bad data, bug), retrying forever blocks the queue. After max retries, move it to the DLQ for inspection and manual replay. DLQ = safety net for poison messages.
Send and forget. May lose messages. Fast, no overhead. Used for logs, metrics where loss is acceptable.
Retry until acknowledged. May deliver duplicates. Consumer must be idempotent. Most common guarantee.
Complex — requires distributed transactions or idempotency keys. Kafka with transactions, or deduplication layer.