0
0
RabbitMQdevops~20 mins

Publishing messages in RabbitMQ - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
RabbitMQ Publisher Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this RabbitMQ publish command?
You run the following command to publish a message to a RabbitMQ queue named task_queue. What is the expected output or result?
RabbitMQ
rabbitmqadmin publish routing_key=task_queue payload='Hello World!'
AMessage published but returned an error code 500
BError: Queue 'task_queue' does not exist
CSyntax error: missing exchange parameter
DMessage published successfully with no output
Attempts:
2 left
💡 Hint
The default exchange is used if no exchange is specified, so the message goes directly to the queue.
🧠 Conceptual
intermediate
2:00remaining
Which RabbitMQ exchange type routes messages to all bound queues?
You want to send a message that all queues bound to an exchange will receive. Which exchange type should you use?
ADirect exchange
BTopic exchange
CFanout exchange
DHeaders exchange
Attempts:
2 left
💡 Hint
Think of a loudspeaker broadcasting to everyone.
Configuration
advanced
2:30remaining
Which configuration snippet correctly declares a durable queue and publishes a persistent message?
You want to ensure that your queue survives RabbitMQ restarts and that messages are not lost. Which configuration snippet achieves this?
A
queue_declare(queue='task_queue', durable=False)
publish(exchange='', routing_key='task_queue', body='data', properties={'delivery_mode': 1})
B
queue_declare(queue='task_queue', durable=True)
publish(exchange='', routing_key='task_queue', body='data', properties={'delivery_mode': 2})
C
queue_declare(queue='task_queue')
publish(exchange='', routing_key='task_queue', body='data')
D
queue_declare(queue='task_queue', durable=True)
publish(exchange='', routing_key='task_queue', body='data', properties={'delivery_mode': 1})
Attempts:
2 left
💡 Hint
Durable queues and persistent messages require specific flags.
Troubleshoot
advanced
2:00remaining
Why does this publish command fail with a channel error?
You run this command: rabbitmqadmin publish exchange=logs routing_key=info payload='Test' But it fails with a channel error. What is the most likely cause?
AThe exchange 'logs' does not exist
BThe routing key 'info' is invalid syntax
CThe payload is missing required headers
DThe rabbitmqadmin tool is outdated
Attempts:
2 left
💡 Hint
Check if the exchange you are publishing to exists.
🔀 Workflow
expert
3:00remaining
What is the correct sequence to publish a message with confirmation in RabbitMQ?
Arrange the steps in the correct order to publish a message and confirm it was received by RabbitMQ.
A1,2,3,4
B2,1,3,4
C1,3,2,4
D2,3,1,4
Attempts:
2 left
💡 Hint
You must enable confirms before publishing.