0
0
RabbitMQdevops~10 mins

Queue TTL and auto-expiry in RabbitMQ - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set a queue with a message TTL of 60000 milliseconds.

RabbitMQ
rabbitmqctl set_policy TTL "^myqueue$" '{"message-ttl": [1]' --apply-to queues
Drag options to blanks, or click blank then click option'
A60000
B6000
C600000
D60
Attempts:
3 left
💡 Hint
Common Mistakes
Using seconds instead of milliseconds
Setting TTL too low or too high by mistake
2fill in blank
medium

Complete the code to declare a queue with auto-expiry of 300000 milliseconds using rabbitmqadmin.

RabbitMQ
rabbitmqadmin declare queue name=myqueue durable=true arguments='{"x-expires": [1]'
Drag options to blanks, or click blank then click option'
A300
B30000
C3000
D300000
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing message TTL with queue expiry
Using seconds instead of milliseconds
3fill in blank
hard

Fix the error in the policy command to set queue TTL to 120000 milliseconds.

RabbitMQ
rabbitmqctl set_policy TTL "^myqueue$" '{"message-ttl": [1]' --apply-to queues
Drag options to blanks, or click blank then click option'
A120000
B1200
C12000
D"120000"
Attempts:
3 left
💡 Hint
Common Mistakes
Putting TTL value in quotes causing syntax error
Using wrong TTL value
4fill in blank
hard

Fill both blanks to declare a queue with message TTL and auto-expiry set.

RabbitMQ
rabbitmqadmin declare queue name=myqueue durable=true arguments='{"x-message-ttl": [1], "x-expires": [2]'
Drag options to blanks, or click blank then click option'
A60000
B120000
C180000
D300000
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up TTL and expiry values
Using same value for both TTL and expiry
5fill in blank
hard

Fill all three blanks to set a policy that applies TTL and auto-expiry to queues starting with 'task_'.

RabbitMQ
rabbitmqctl set_policy taskTTL "^task_.*" '{"message-ttl": [1], "expires": [2], "auto-delete": [3]' --apply-to queues
Drag options to blanks, or click blank then click option'
A60000
B180000
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using string 'true' instead of boolean true
Confusing expires with message-ttl