0
0
RabbitMQdevops~5 mins

Direct exchange in RabbitMQ - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
APattern matching with wildcards
BExact matching of routing keys
CBroadcast to all queues
DRandom queue selection
If a message's routing key is 'error' and a queue is bound with 'error', where will the message go?
ATo the queue bound with 'error'
BTo all queues
CNowhere, message is discarded
DTo queues with similar keys like 'errors'
Which command declares a direct exchange named 'my_direct'?
Arabbitmqadmin declare exchange name=my_direct type=direct
Brabbitmqadmin declare exchange name=my_direct type=fanout
Crabbitmqadmin declare queue name=my_direct
Drabbitmqadmin declare exchange name=my_direct type=topic
What happens if no queue matches the routing key in a Direct Exchange and the message is not mandatory?
AMessage is sent to all queues
BMessage is stored in a dead letter queue
CMessage is discarded
DMessage is returned to sender
Which exchange type broadcasts messages to all bound queues regardless of routing key?
AHeaders Exchange
BDirect Exchange
CTopic Exchange
DFanout Exchange
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.