In RabbitMQ, where does a producer send messages?
- A.Straight into the queue the consumer reads from
- B.Into an exchange
- C.To the broker, which picks a queue at random
- D.Directly to the consumer over a separate TCP connection
Answer: B
A producer always publishes to an exchange, never directly to a queue. The exchange looks at the message's routing key and the bindings to decide which queue to route to. Even when the code appears to "send to a queue", it's actually sending through the default exchange with a routing key matching the queue name.
References