Recall & Review
beginner
What is a Direct Exchange in RabbitMQ?
A Direct Exchange routes messages to queues based on an exact match between the message's routing key and the queue's binding key.
Click to reveal answer
beginner
How does a Direct Exchange decide which queue to send a message to?
It sends the message to the queue(s) whose binding key exactly matches the message's routing key.
Click to reveal answer
intermediate
What happens if no queue is bound with a matching routing key in a Direct Exchange?
The message is discarded or returned to the sender if the message is marked as mandatory.
Click to reveal answer
beginner
Show the RabbitMQ command to declare a direct exchange named 'logs_direct'.
rabbitmqadmin declare exchange name=logs_direct type=direct
Click to reveal answer
intermediate
Explain the difference between a Direct Exchange and a Fanout Exchange.
A Direct Exchange routes messages based on exact routing key matches, while a Fanout Exchange broadcasts messages to all bound queues regardless of routing keys.
Click to reveal answer
What type of matching does a Direct Exchange use to route messages?
✗ Incorrect
Direct Exchanges route messages only to queues with binding keys that exactly match the routing key.
If a message's routing key is 'error' and a queue is bound with 'error', where will the message go?
✗ Incorrect
The message is routed only to queues with an exact binding key match.
Which command declares a direct exchange named 'my_direct'?
✗ Incorrect
The command specifies the exchange name and sets its type to direct.
What happens if no queue matches the routing key in a Direct Exchange and the message is not mandatory?
✗ Incorrect
Without a matching queue and if not mandatory, the message is discarded.
Which exchange type broadcasts messages to all bound queues regardless of routing key?
✗ Incorrect
Fanout Exchanges ignore routing keys and send messages to all queues.
Describe how a Direct Exchange routes messages in RabbitMQ.
Think about how the message's routing key compares to the queue's binding key.
You got /4 concepts.
Explain the difference between Direct Exchange and Fanout Exchange in RabbitMQ.
One sends messages to specific queues, the other sends to all.
You got /4 concepts.