0
0
RabbitMQdevops~20 mins

Queue TTL and auto-expiry in RabbitMQ - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
RabbitMQ TTL Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Queue TTL behavior in RabbitMQ

What happens to messages in a RabbitMQ queue when the queue has a TTL (time-to-live) set on messages?

AMessages are moved to a dead-letter queue only if the TTL is set on the queue, not on messages.
BMessages expire and are removed from the queue after the TTL duration, even if they are not consumed.
CMessages are deleted immediately when the queue is declared with TTL, regardless of message age.
DMessages remain in the queue indefinitely until consumed, TTL only applies to the queue itself.
Attempts:
2 left
💡 Hint

Think about what TTL means for individual messages in a queue.

💻 Command Output
intermediate
1:30remaining
Queue auto-expiry effect on queue existence

Given a queue declared with x-expires set to 60000 (60 seconds), what happens if the queue is unused for 70 seconds?

RabbitMQ
rabbitmqctl list_queues name messages
# After 70 seconds of no consumers or messages
AThe queue is automatically deleted and will not appear in the list.
BThe queue remains but all messages inside expire.
CThe queue remains with zero messages but is not deleted.
DThe queue is paused and will not accept new messages.
Attempts:
2 left
💡 Hint

Consider what x-expires controls in RabbitMQ.

Configuration
advanced
2:00remaining
Correct queue declaration with message TTL and auto-expiry

Which of the following queue declarations correctly sets a message TTL of 30 seconds and auto-expiry of 2 minutes?

Arabbitmqadmin declare queue name=myqueue arguments={"x-message-ttl":120000,"x-expires":30000}
Brabbitmqadmin declare queue name=myqueue arguments={"x-expires":30000,"x-message-ttl":120000}
Crabbitmqadmin declare queue name=myqueue arguments={"x-message-ttl":30000,"x-expires":120000}
Drabbitmqadmin declare queue name=myqueue arguments={"x-expires":60000,"x-message-ttl":60000}
Attempts:
2 left
💡 Hint

Remember TTL values are in milliseconds and x-message-ttl is for messages, x-expires is for queue expiry.

Troubleshoot
advanced
2:00remaining
Diagnosing why messages are not expiring as expected

You set x-message-ttl to 10000 (10 seconds) on a queue, but messages remain indefinitely. What is the most likely cause?

AThe messages were published with individual TTLs overriding the queue TTL.
BThe queue has active consumers that keep messages from expiring.
CThe queue is a classic queue and does not support TTL.
DThe <code>x-message-ttl</code> argument was set on the queue but not on the messages.
Attempts:
2 left
💡 Hint

Consider how message TTLs interact with queue TTL settings.

🔀 Workflow
expert
2:30remaining
Sequence to configure and verify queue TTL and auto-expiry

Arrange the steps in the correct order to configure a RabbitMQ queue with message TTL and auto-expiry, then verify the settings.

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

Think about what must happen before publishing messages and verifying settings.