0
0
RabbitMQdevops~20 mins

Fanout exchange (broadcast) in RabbitMQ - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Fanout Exchange Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output when a message is published to a fanout exchange with two queues bound?

Assume a fanout exchange named logs has two queues queue1 and queue2 bound to it. If a message "Hello" is published to logs, what will be the result?

RabbitMQ
rabbitmqadmin publish exchange=logs routing_key= payload="Hello"
AOnly queue1 receives the message "Hello"
BBoth queue1 and queue2 receive the message "Hello"
COnly queue2 receives the message "Hello"
DNo queue receives the message because routing_key is empty
Attempts:
2 left
💡 Hint

Fanout exchanges ignore routing keys and broadcast messages to all bound queues.

🧠 Conceptual
intermediate
1:30remaining
Which statement correctly describes a fanout exchange?

Choose the correct description of how a fanout exchange works in RabbitMQ.

AIt stores messages until a consumer connects, then sends them.
BIt routes messages to queues based on exact matching routing keys.
CIt broadcasts messages to all queues bound to it, ignoring routing keys.
DIt routes messages to queues based on pattern matching routing keys.
Attempts:
2 left
💡 Hint

Think about how a broadcast works in real life.

Configuration
advanced
2:00remaining
Which configuration correctly declares a fanout exchange named 'broadcast_logs' using rabbitmqctl?

Select the correct command to declare a fanout exchange named broadcast_logs using rabbitmqctl.

Arabbitmqadmin declare exchange name=broadcast_logs type=fanout
Brabbitmqadmin add exchange broadcast_logs fanout
Crabbitmqctl declare exchange name=broadcast_logs type=fanout
Drabbitmqctl add_exchange broadcast_logs fanout
Attempts:
2 left
💡 Hint

Remember which tool is used for declaring exchanges and the correct syntax.

Troubleshoot
advanced
2:30remaining
Why does a message published to a fanout exchange not reach any queue?

You have a fanout exchange named logs and a queue queue1 bound to it. You publish a message but queue1 does not receive it. What could be the reason?

AThe queue <code>queue1</code> is not bound to the exchange <code>logs</code> properly.
BThe routing key used in publishing does not match the queue name.
CFanout exchanges require a routing key to deliver messages.
DThe message was too large and was dropped by the exchange.
Attempts:
2 left
💡 Hint

Check the bindings between exchange and queue.

Best Practice
expert
3:00remaining
What is the best practice when using fanout exchanges for broadcasting logs to multiple services?

When designing a system that broadcasts log messages to multiple services using a fanout exchange, which practice is recommended?

ABind all services to the same queue to simplify message consumption.
BUse direct exchanges instead of fanout to control routing precisely.
CPublish messages with routing keys matching each service name.
DUse separate queues for each service bound to the fanout exchange to avoid message loss.
Attempts:
2 left
💡 Hint

Think about how message delivery and consumption work with multiple consumers.