0
0
RabbitMQdevops~20 mins

Consuming messages in RabbitMQ - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
RabbitMQ Consumer 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 consumer command?
You run this command to consume messages from a queue named task_queue. What output will you see if the queue is empty?
RabbitMQ
rabbitmqadmin get queue=task_queue requeue=false count=1
AMessage received: {"task": "process"}
BError: Queue not found
CNo messages returned
DConnection refused
Attempts:
2 left
💡 Hint
Think about what happens when you try to get a message from an empty queue.
Configuration
intermediate
2:00remaining
Which configuration enables manual message acknowledgment in RabbitMQ consumer?
You want your consumer to manually acknowledge messages after processing. Which consumer configuration option achieves this?
Aauto_ack=false
Bauto_ack=true
Cprefetch_count=0
Ddurable=true
Attempts:
2 left
💡 Hint
Manual acknowledgment means the consumer tells RabbitMQ when a message is done.
🔀 Workflow
advanced
3:00remaining
What is the correct order to consume and acknowledge a message manually?
Arrange these steps in the correct order for a RabbitMQ consumer that manually acknowledges messages.
A3,1,2,4
B1,3,2,4
C2,1,3,4
D1,2,3,4
Attempts:
2 left
💡 Hint
Think about when you should acknowledge a message.
Troubleshoot
advanced
2:30remaining
Why does this RabbitMQ consumer fail to receive messages?
A consumer is connected but does not receive any messages from the queue. The consumer code uses auto_ack=true and prefetch_count=1. What is the most likely cause?
AThe queue is empty or messages are already acknowledged
Bprefetch_count=1 blocks all messages
Cauto_ack=true prevents message delivery
DThe consumer is not connected to the correct exchange
Attempts:
2 left
💡 Hint
Consider what happens if the queue has no messages or they are already consumed.
Best Practice
expert
3:00remaining
Which practice improves reliability when consuming messages in RabbitMQ?
You want to ensure no messages are lost if your consumer crashes during processing. Which practice is best?
AUse <code>auto_ack=true</code> to speed up processing
BUse manual acknowledgment with <code>auto_ack=false</code> and acknowledge after processing
CSet <code>prefetch_count=0</code> to allow unlimited messages
DUse non-durable queues to avoid message persistence
Attempts:
2 left
💡 Hint
Think about how to avoid losing messages if the consumer crashes.