veda.ng
Back to Glossary

Message Queue

A message queue is an asynchronous communication pattern where services send messages to a queue for later processing. Instead of Service A calling Service B directly and waiting for a response, Service A sends a message to a queue. Service B reads from the queue when it's ready. This decouples producers from consumers. Producers don't care when consumers process messages.

Consumers don't care when producers send messages. They just need to read from the same queue. This enables scalable, resilient systems. If a consumer is overloaded, messages pile up in the queue. When capacity increases, the consumer catches up. If a consumer crashes, messages wait in the queue until the consumer restarts. If a producer crashes, already-sent messages are safe in the queue.

RabbitMQ, Kafka, and AWS SQS are popular message queues. They differ in guarantees, some ensure exactly-once delivery, some at-least-once. They differ in throughput and latency. But the concept is the same. Message queues are fundamental to building scalable, event-driven architectures. They're how asynchronous systems work at scale.