Topic Exchange — Concept Check
Questions on Topic Exchange. Routes by pattern-matching the routing key using * (one word) and # (zero or more words); enables flexible multi-level routing such as logs.error.# or payments.*.
Questions in this quiz
8 questions on Topic Exchange — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A message with routing key 'order.shipment.delivered' is sent to a topic exchange. Which binding pattern will NOT match this message?
- A#.delivered
- B*.shipment.*
- Corder.shipment.*
- Dorder.#
2.You have a queue bound with the pattern '#.failed'. A message with routing key 'order.payment.failed' is published. What happens?
- AThe message is not delivered to the queue
- BThe message is delivered only if it ends with 'failed'
- CThe message is delivered only if it starts with 'order'
- DThe message is delivered to the queue
3.In a topic exchange, which pattern will match both 'order.created' and 'order.payment.failed'?
- A#.failed
- Border.*
- Corder.#
- D*.created
4.A developer binds a queue with the pattern '*.payment.*' but notices no messages are delivered. What could be the issue?
- AMessages have routing keys like 'order.payment.failed'
- BThe pattern should be 'order.payment.*'
- CThe exchange type might be set incorrectly
- DThe queue is not declared as durable
5.A queue is bound with the pattern 'order.payment.*'. Which routing key will NOT match this pattern?
- Aorder.payment.cancelled
- Border.payment.failed
- Corder.payment
- Dorder.payment.succeeded
6.Which binding pattern will match every possible routing key in a topic exchange?
- A#
- B*.*.*
- Corder.#
- D*.#
7.A developer binds a queue with 'order.*' expecting to receive all order-related messages. Why is this incorrect?
- AIt matches all messages, not just order-related
- BIt only matches messages with no words after 'order'
- CIt only matches messages with one word after 'order'
- DIt requires a specific routing key to match
8.In Spring AMQP, what is the correct way to bind a queue to a topic exchange with the pattern 'order.#'?
- ABindingBuilder.to(exchange).bind(queue).with('order.#')
- Bqueue.bind(exchange).with('order.#')
- CBindingBuilder.bind(queue).to(exchange).with('order.#')
- Dexchange.bind(queue).with('order.#')