Integration / RabbitMQ Interview Questions
Why doesn't RabbitMQ guarantee message ordering in all cases?
RabbitMQ preserves strict FIFO order only within a single queue, delivered to a single consumer, and even then only under specific conditions - several common setups break that guarantee.
- Multiple consumers on one queue - messages are dispatched round-robin, so consumer A and consumer B may finish processing in a different order than the messages were enqueued.
- Requeued/redelivered messages - a nacked message often goes back to a different position, interleaving with newer arrivals rather than resuming its original spot.
- Priority queues - by design, higher-priority messages jump ahead of lower-priority ones already waiting.
- Sharding across multiple queues (e.g. via a consistent-hash exchange) - order is only preserved within a shard, not globally.
If strict ordering is a hard requirement, the usual approach is a single queue with a single consumer for that ordering domain, accepting the throughput ceiling that comes with it.
More Related questions...