0
0
RabbitMQdevops~10 mins

Retry patterns with exponential backoff 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 declare a queue with a dead-letter exchange for retries.

RabbitMQ
channel.queue_declare(queue='task_queue', durable=True, arguments={'x-dead-letter-exchange': '[1]'})
Drag options to blanks, or click blank then click option'
Aerror_exchange
Bmain_exchange
Cretry_exchange
Dbackup_exchange
Attempts:
3 left
💡 Hint
Common Mistakes
Using the main exchange name instead of the retry exchange.
2fill in blank
medium

Complete the code to set the message TTL (time-to-live) for retry delay.

RabbitMQ
channel.queue_declare(queue='retry_queue', arguments={'x-message-ttl': [1])
Drag options to blanks, or click blank then click option'
A1000
B60000
C500
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 or too small TTL causing immediate retries.
3fill in blank
hard

Fix the error in the retry delay calculation for exponential backoff in milliseconds.

RabbitMQ
retry_delay = base_delay * (2 [1] attempt)
Drag options to blanks, or click blank then click option'
A+
B//
C-
D**
Attempts:
3 left
💡 Hint
Common Mistakes
Using addition or subtraction instead of exponentiation.
4fill in blank
hard

Fill both blanks to set the dead-letter exchange and routing key for the retry queue.

RabbitMQ
channel.queue_declare(queue='retry_queue', arguments={'x-dead-letter-exchange': '[1]', 'x-dead-letter-routing-key': '[2]'})
Drag options to blanks, or click blank then click option'
Amain_exchange
Btask_queue
Cretry_key
Derror_key
Attempts:
3 left
💡 Hint
Common Mistakes
Using the retry exchange or wrong routing key causing message loss.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that sets retry delays with exponential backoff for attempts 1 to 3.

RabbitMQ
retry_delays = {attempt: base_delay [1] (2 [2] attempt) for attempt in range(1, 4) if attempt [3] 3}
Drag options to blanks, or click blank then click option'
A*
B**
C<=
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' instead of '*', or wrong comparison operator.