0
0
RabbitMQdevops~5 mins

Topic exchange (pattern matching) in RabbitMQ - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Topic Exchange in RabbitMQ?
A Topic Exchange routes messages to queues based on matching between a message routing key and the pattern that was used to bind a queue to the exchange. It uses wildcards for flexible routing.
Click to reveal answer
beginner
What wildcard characters are used in Topic Exchange bindings?
The '*' (star) matches exactly one word, and the '#' (hash) matches zero or more words in the routing key.
Click to reveal answer
intermediate
How does the routing key 'stock.usd.nyse' match the binding key 'stock.*.*'?
The routing key 'stock.usd.nyse' matches 'stock.*.*' because '*' matches exactly one word. Here, 'usd' and 'nyse' each match one '*'.
Click to reveal answer
intermediate
Explain the difference between '*' and '#' in Topic Exchange pattern matching.
'*' matches exactly one word in the routing key, while '#' matches zero or more words, allowing more flexible matching.
Click to reveal answer
beginner
What happens if a message's routing key does not match any binding pattern in a Topic Exchange?
The message is discarded or returned to the sender if no queue binding matches the routing key pattern in the Topic Exchange.
Click to reveal answer
Which wildcard in a Topic Exchange matches zero or more words?
A#
B*
C?
D%
What does the routing key 'log.error.system' match if the binding key is 'log.*.*'?
AMatches only if '#' is used
BDoes not match
CMatches only if '*' is replaced by '#'
DMatches
If a queue is bound with 'sensor.#', which routing key will NOT match?
Asensor.temperature
Bsensor.temperature.outdoor
Cdevice.sensor.temperature
Dsensor
What type of exchange uses pattern matching with wildcards '*' and '#'?
ADirect Exchange
BTopic Exchange
CFanout Exchange
DHeaders Exchange
Which binding key would match routing keys with exactly three words starting with 'app'?
Aapp.*.*
Bapp.#
C*.app.*
D#.app
Describe how the '*' and '#' wildcards work in RabbitMQ Topic Exchange pattern matching.
Think about how many words each wildcard can match in the routing key.
You got /3 concepts.
    Explain what happens when a message is sent to a Topic Exchange with a routing key that does not match any queue binding.
    Consider how routing keys and binding keys interact in message delivery.
    You got /3 concepts.