RabbitMQ interview questions

25 questions from the RabbitMQ course, each with the correct answer and an explanation. Try to answer before you open the answer.

Message Brokers and the RabbitMQ Model

1. Which is a typical use of RabbitMQ?

  1. Distributing background jobs across many workers
  2. Long-term analytical storage
  3. Serving static web pages
  4. Replacing a relational database
Show answer

Answer: Distributing background jobs across many workers

Work queues that spread jobs across workers are a classic RabbitMQ use case.

Lesson: What RabbitMQ Is For

2. In AMQP 0-9-1, where does a producer publish a message?

  1. Directly into a queue file
  2. To a consumer's IP address
  3. To a vhost without any exchange
  4. To an exchange, which routes it to queues through bindings
Show answer

Answer: To an exchange, which routes it to queues through bindings

Producers publish to exchanges; bindings decide which queues receive the message.

Lesson: Exchanges, Queues, Bindings, Vhosts and Channels

3. Which port does the RabbitMQ management web UI use by default?

  1. 5672
  2. 8080
  3. 15672
  4. 443
Show answer

Answer: 15672

5672 is AMQP; the management UI listens on 15672.

Lesson: Running RabbitMQ and the Management UI

Exchanges and Messaging Patterns

4. Three services must each receive every UserRegistered message. Which setup fits best?

  1. One queue shared by all three services
  2. The default exchange with one queue
  3. A fanout (or topic) exchange with a separate queue per service
  4. A direct exchange with no bindings
Show answer

Answer: A fanout (or topic) exchange with a separate queue per service

Each service needs its own queue bound to the exchange so it gets its own copy.

Lesson: Default, Direct and Fanout Exchanges

5. Which routing key matches the binding pattern `order.*.in`?

  1. order.placed
  2. order.placed.in
  3. order.placed.express.in
  4. payment.placed.in
Show answer

Answer: order.placed.in

`*` matches exactly one word, so only `order.placed.in` fits.

Lesson: Topic and Headers Exchanges

6. In a work-queue pattern with three consumers on one queue, how many consumers receive each message?

  1. Exactly one
  2. All three
  3. None until acknowledged
  4. Two, for redundancy
Show answer

Answer: Exactly one

Competing consumers share the queue; each message is delivered to one of them.

Lesson: Work Queues, Pub/Sub, Routing and RPC

Consuming Messages Reliably

7. With automatic acknowledgement, what happens if a consumer crashes while processing a message?

  1. The message is lost because it was considered delivered
  2. The message is requeued automatically
  3. The message goes to a dead-letter exchange
  4. The broker restarts the consumer
Show answer

Answer: The message is lost because it was considered delivered

Auto-ack treats delivery as completion, so a crash during processing loses the message.

Lesson: Acknowledgements

8. What does basic_qos(prefetch_count=10) control?

  1. The maximum queue length
  2. The number of retries
  3. Message TTL in seconds
  4. The maximum number of unacknowledged messages delivered to the consumer at once
Show answer

Answer: The maximum number of unacknowledged messages delivered to the consumer at once

Prefetch limits in-flight unacked messages per consumer (or channel).

Lesson: Prefetch, Fair Dispatch and Competing Consumers

9. Why can a consumer receive the same message twice with manual acknowledgements?

  1. RabbitMQ always sends two copies
  2. Prefetch duplicates messages
  3. If the ack is lost after processing, the broker redelivers the message
  4. Topic exchanges duplicate every message
Show answer

Answer: If the ack is lost after processing, the broker redelivers the message

At-least-once delivery redelivers messages whose acknowledgements did not arrive.

Lesson: Redelivery, Ordering and Idempotent Consumers

Publishing Reliably and Handling Failures

10. What does a publisher confirm (ack) from the broker tell the publisher?

  1. A consumer has processed the message
  2. The message was routed to every queue in the vhost
  3. The broker has taken responsibility for the message (for example, persisted or replicated it)
  4. The message has expired
Show answer

Answer: The broker has taken responsibility for the message (for example, persisted or replicated it)

Confirms cover publisher-to-broker safety, not consumer processing.

Lesson: Publisher Confirms and Returns

11. A durable queue receives a non-persistent message, then the broker restarts. What happens to the message?

  1. It survives because the queue is durable
  2. It is lost because the message itself was not persisted
  3. It moves to a dead-letter exchange
  4. It is converted to persistent automatically
Show answer

Answer: It is lost because the message itself was not persisted

Both a durable queue and a persistent message are needed for the message to survive restarts.

Lesson: Durability and Persistence

12. Which event does NOT cause a message to be dead-lettered?

  1. The consumer acknowledges it successfully
  2. The consumer nacks it with requeue=false
  3. Its message TTL expires
  4. A quorum queue delivery limit is exceeded
Show answer

Answer: The consumer acknowledges it successfully

Successful acknowledgement removes the message; the others trigger dead-lettering when a DLX is configured.

Lesson: Dead-Letter Exchanges, TTL and Retry Strategies

Queue Types: Classic, Quorum and Streams

13. What replaced classic mirrored queues for replicated, durable messaging in RabbitMQ 4.x?

  1. Quorum queues (and streams)
  2. Exclusive queues
  3. Auto-delete queues
  4. Headers exchanges
Show answer

Answer: Quorum queues (and streams)

Mirrored classic queues were removed; quorum queues and streams provide replication.

Lesson: Classic Queues

14. When does a quorum queue confirm a published message?

  1. As soon as the leader receives it in memory
  2. After every consumer has acknowledged it
  3. Only after the queue is empty
  4. After a majority of replicas have written it
Show answer

Answer: After a majority of replicas have written it

Raft commits a message once a majority of replicas have it, which is what makes it safe.

Lesson: Quorum Queues

15. What happens to a message in a RabbitMQ stream after a consumer reads it?

  1. It is deleted immediately
  2. It moves to a dead-letter queue
  3. It stays in the stream until retention removes it, so other consumers can read it too
  4. It is converted into a classic queue message
Show answer

Answer: It stays in the stream until retention removes it, so other consumers can read it too

Streams are non-destructive logs; retention by size or age decides when data is removed.

Lesson: RabbitMQ Streams

Clustering, Monitoring and Security

16. Why are RabbitMQ clusters usually built with an odd number of nodes such as three?

  1. Licensing rules
  2. Exchanges require three nodes
  3. So quorum queues and metadata keep a majority if one node fails
  4. Odd numbers make TLS faster
Show answer

Answer: So quorum queues and metadata keep a majority if one node fails

Majority-based replication needs a quorum; three nodes tolerate one failure.

Lesson: Clustering and High Availability

17. What does RabbitMQ do when a node reaches its memory high watermark?

  1. Deletes the largest queue
  2. Blocks publishing connections until memory drops, while consumers continue
  3. Shuts down immediately
  4. Converts queues to streams
Show answer

Answer: Blocks publishing connections until memory drops, while consumers continue

Resource alarms block publishers to protect the broker while letting consumers drain queues.

Lesson: Monitoring and Resource Alarms

18. Which RabbitMQ permission is needed to consume from a queue?

  1. read
  2. configure
  3. write
  4. administrator tag
Show answer

Answer: read

Read permission on the queue is required to consume messages from it.

Lesson: Users, Permissions and TLS

Designing with RabbitMQ

19. In a domain-oriented topology, who usually owns a consumer queue such as billing.orders?

  1. The billing team, which consumes from it
  2. The orders team, because it publishes the messages
  3. Nobody; queues are anonymous
  4. The database team
Show answer

Answer: The billing team, which consumes from it

Each consuming service owns its queue, prefetch, scaling and dead-letter handling.

Lesson: Designing a Topology

20. What does the `reject-publish` overflow setting do when a queue reaches its length limit?

  1. Deletes the oldest messages silently
  2. Doubles the limit automatically
  3. Moves the queue to another node
  4. Rejects new publishes, which publishers see as nacks when confirms are enabled
Show answer

Answer: Rejects new publishes, which publishers see as nacks when confirms are enabled

reject-publish refuses new messages instead of dropping old ones, signalling back-pressure to publishers.

Lesson: Priorities, Delays, Length Limits and Single Active Consumer

21. Which requirement points most strongly towards a log-based system such as Kafka (or RabbitMQ streams) rather than classic queues?

  1. Per-message priorities
  2. A simple background email job
  3. Many consumers replaying months of ordered events
  4. Request-reply with correlation IDs
Show answer

Answer: Many consumers replaying months of ordered events

Long retention with replay by many independent consumers is the defining strength of logs.

Lesson: RabbitMQ vs Kafka vs Cloud Queues

Clients, Performance and Revision

22. Which practice is recommended for RabbitMQ client connections?

  1. Open a new connection for every message
  2. Share one channel across all threads
  3. Keep a long-lived connection per process and use channels for operations
  4. Disable heartbeats
Show answer

Answer: Keep a long-lived connection per process and use channels for operations

Long-lived connections with appropriately scoped channels avoid churn and thread-safety problems.

Lesson: Client Best Practices

23. A single queue receives so many messages that its node shows one CPU core saturated. What usually helps?

  1. Making messages larger
  2. Spreading the work across several queues (for example with a consistent hash exchange or super streams)
  3. Disabling acknowledgements
  4. Adding more bindings to the same queue
Show answer

Answer: Spreading the work across several queues (for example with a consistent hash exchange or super streams)

Each queue has one process (or leader), so partitioning across queues spreads the load.

Lesson: Performance and Capacity

24. In the case study, what prevents a poison message from being retried forever?

  1. An attempt counter plus the quorum delivery limit, which send it to a parking-lot queue
  2. A larger prefetch
  3. Auto-ack mode
  4. Publisher confirms
Show answer

Answer: An attempt counter plus the quorum delivery limit, which send it to a parking-lot queue

After a bounded number of attempts the message is parked for inspection instead of looping.

Lesson: Case Study: Order Processing with RabbitMQ

25. Which combination gives the strongest guarantee that a published order event is not lost and is processed once in effect?

  1. Auto-ack consumers and transient messages
  2. Fanout exchange with exclusive queues
  3. Classic queues with no confirms
  4. Outbox publishing with confirms, persistent messages on a quorum queue, and idempotent consumers with manual acks
Show answer

Answer: Outbox publishing with confirms, persistent messages on a quorum queue, and idempotent consumers with manual acks

Each hop needs its own safeguard: confirms, replication, manual acks and deduplication.

Lesson: Revision and Interview Questions

← Back to the course