Message queues decouple service execution by introducing an asynchronous buffer between producers and consumers.
| Feature | RabbitMQ | Apache Kafka | AWS SQS |
|---|---|---|---|
| Model | Push (Broker manages state) | Pull (Consumer tracks offset) | Pull (Stateless API) |
| Ordering | Guaranteed per queue | Guaranteed per partition | FIFO queues only |
| Throughput | High (tens of K/sec) | Extreme (millions/sec) | Scales infinitely (managed) |
| Durability | Ephemeral or Persistent | Persistent (Distributed Log) | Durable (Replicated) |
| Routing | Complex (Exchanges/Bindings) | Simple (Topic-based) | Simple (Queue-based) |
A Poison Pill is a message that causes a consumer to crash or fail repeatedly.
Messages that fail more than Ntimes are moved to a DLQ for manual inspection. This prevents a single malformed message from blocking the entire pipeline.
When a processing error occurs (e.g., DB is down), the consumer should delay the next retry to avoid a self-inflicted DoS.
Jitter is essential to prevent "thundering herd" synchronization across multiple workers.
Multiple workers pull from one queue. Each message is processed by exactly one worker. Used for horizontal scaling of job processing.
One message is copied toNindependent queues, each serving a different consumer group. Used for cross-service event notification.
Streaming database transaction logs (via Kafka Connect/Debezium) into a queue. Used to maintain read replicas or search indices without modifying application code.