0
0
RabbitMQdevops~20 mins

Publish-subscribe for broadcasting in RabbitMQ - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
RabbitMQ Publish-Subscribe Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
How does the publish-subscribe pattern work in RabbitMQ?

In RabbitMQ, what is the main role of the exchange in the publish-subscribe pattern?

AIt receives messages from producers and routes them to queues based on binding rules.
BIt stores messages until consumers retrieve them directly from the exchange.
CIt acts as a consumer that processes messages and sends acknowledgments.
DIt deletes messages after they are published to prevent duplicates.
Attempts:
2 left
💡 Hint

Think about how messages get from the sender to multiple receivers.

💻 Command Output
intermediate
2:00remaining
Output of binding a queue to a fanout exchange

What is the output of the following RabbitMQ command when binding a queue named logs to a fanout exchange named broadcast?

rabbitmqadmin declare binding source=broadcast destination=logs
A{"result": "success", "source": "broadcast", "destination": "logs"}
BSyntaxError: missing required parameter 'routing_key'
CError: exchange 'broadcast' does not exist
DWarning: fanout exchange ignores routing_key parameter
Attempts:
2 left
💡 Hint

Fanout exchanges do not require a routing key when binding queues.

🔀 Workflow
advanced
3:00remaining
Correct order to set up publish-subscribe with RabbitMQ fanout exchange

Arrange the steps in the correct order to set up a publish-subscribe system using a fanout exchange in RabbitMQ.

A3,2,1,4
B2,1,3,4
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint

Think about declaring resources before using them.

Troubleshoot
advanced
2:30remaining
Why are subscribers not receiving messages in a fanout exchange setup?

You set up a fanout exchange and bound multiple queues to it. However, subscribers connected to these queues do not receive any messages. What is the most likely cause?

AThe queues were declared as exclusive and deleted when the publisher disconnected.
BThe exchange type was set to direct instead of fanout.
CThe queues were not bound to the exchange.
DThe routing key was missing when publishing messages.
Attempts:
2 left
💡 Hint

Check if the queues are connected to the exchange properly.

Best Practice
expert
3:00remaining
Best practice for durable publish-subscribe setup in RabbitMQ

Which option describes the best practice to ensure messages are not lost in a publish-subscribe system using RabbitMQ fanout exchanges?

ADeclare queues as exclusive and auto-delete to clean up resources automatically.
BDeclare the exchange and queues as durable and publish messages as persistent.
CUse transient queues and non-persistent messages for faster delivery.
DPublish messages without acknowledgments to reduce latency.
Attempts:
2 left
💡 Hint

Think about how to keep messages safe even if RabbitMQ restarts.