RabbitMQ & AMQP (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is Single Active Consumer (`x-single-active-consumer`)?
senior LevelSystem Design
In Simple Words: When multiple consumers attach to a single queue, RabbitMQ shares messages among them, meaning message ordering is lost if one consumer processes faster than another.
- Setting
'x-single-active-consumer': trueguarantees that only one consumer actively receives messages at any given time. - The other connected consumers stay in standby. If the active consumer disconnects or crashes, RabbitMQ immediately promotes a standby consumer to active.
- Provides strict FIFO processing across multiple redundant instances without manual leader election.