0
0
RabbitMQdevops~20 mins

Handling consumer failures in RabbitMQ - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
RabbitMQ Consumer Failure Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What happens when a RabbitMQ consumer crashes without acknowledging a message?

Imagine a RabbitMQ consumer receives a message but crashes before sending an acknowledgment. What will RabbitMQ do with that message?

AThe message remains unacknowledged and will be redelivered to another consumer after the connection closes.
BThe message is lost and removed from the queue permanently.
CRabbitMQ automatically deletes the queue to prevent message loss.
DThe message is acknowledged automatically by RabbitMQ to avoid blocking.
Attempts:
2 left
💡 Hint

Think about how RabbitMQ ensures messages are not lost when consumers fail.

💻 Command Output
intermediate
2:00remaining
What is the output of this RabbitMQ consumer log snippet after a consumer failure?

Given the following log lines from a RabbitMQ consumer process:

2024-06-01 10:00:00 Consumer connected to queue 'task_queue'
2024-06-01 10:00:05 Received message: 'Process data'
2024-06-01 10:00:06 Consumer crashed unexpectedly
2024-06-01 10:00:07 Message requeued for delivery

What does the last line indicate?

AThe message was acknowledged before the crash.
BThe message was put back into the queue for another consumer.
CThe message was lost due to the crash.
DThe queue was deleted after the crash.
Attempts:
2 left
💡 Hint

Look for the meaning of 'requeued' in message queues.

Configuration
advanced
2:30remaining
Which RabbitMQ consumer configuration ensures messages are not lost if the consumer crashes?

Choose the correct consumer configuration snippet that guarantees message acknowledgment is manual and messages are requeued on failure.

Achannel.basic_consume(queue='task_queue', auto_ack=False, on_message_callback=callback)
Bchannel.basic_consume(queue='task_queue', auto_ack=True, on_message_callback=callback)
Cchannel.basic_consume(queue='task_queue', auto_ack=True, exclusive=True)
Dchannel.basic_consume(queue='task_queue', no_ack=True, on_message_callback=callback)
Attempts:
2 left
💡 Hint

Consider how automatic acknowledgment affects message safety.

Troubleshoot
advanced
2:30remaining
Why does a RabbitMQ queue keep growing even though consumers are running?

You notice that the message count in a RabbitMQ queue keeps increasing despite consumers being connected. Which of the following is the most likely cause?

AConsumers have <code>auto_ack=True</code> and messages are acknowledged immediately.
BThe queue is set to <code>exclusive=True</code>, preventing message delivery.
CRabbitMQ automatically deletes messages after consumer failure.
DConsumers are crashing before acknowledging messages, causing messages to be requeued repeatedly.
Attempts:
2 left
💡 Hint

Think about what happens if messages are never acknowledged.

🔀 Workflow
expert
3:00remaining
Order the steps RabbitMQ follows when a consumer fails before acknowledging a message

Put these RabbitMQ steps in the correct order when a consumer crashes before acknowledging a message.

A2,1,3,4
B1,3,2,4
C1,2,3,4
D1,2,4,3
Attempts:
2 left
💡 Hint

Think about the natural sequence of events from message receipt to requeue.