0
0
RabbitMQdevops~10 mins

Exactly-once processing strategies 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 durable queue in RabbitMQ.

RabbitMQ
channel.queue_declare(queue='task_queue', durable=[1])
Drag options to blanks, or click blank then click option'
AFalse
BNone
CTrue
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using False makes the queue non-durable, risking message loss.
2fill in blank
medium

Complete the code to acknowledge a message after processing it.

RabbitMQ
channel.basic_ack(delivery_tag=[1])
Drag options to blanks, or click blank then click option'
Amethod.delivery_tag
Bmessage
Cchannel
Dbody
Attempts:
3 left
💡 Hint
Common Mistakes
Using the message body or channel instead of delivery tag causes errors.
3fill in blank
hard

Fix the error in the code to enable publisher confirms for exactly-once delivery.

RabbitMQ
channel.[1]()
Drag options to blanks, or click blank then click option'
Aconfirm_delivery
Bconfirm_select
Cenable_confirm
Dpublisher_confirm
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names causes AttributeError.
4fill in blank
hard

Fill both blanks to set message properties for persistent delivery and publish a message.

RabbitMQ
channel.[2]()
channel.basic_publish(exchange='', routing_key='task_queue', body=message, properties=pika.BasicProperties(delivery_mode=[1]))
Drag options to blanks, or click blank then click option'
A2
B1
Cbasic_ack
Dconfirm_select
Attempts:
3 left
💡 Hint
Common Mistakes
Using delivery_mode=1 makes messages transient.
5fill in blank
hard

Fill both blanks to create a consumer that processes messages exactly once with manual acknowledgments and prefetch count.

RabbitMQ
channel.basic_qos(prefetch_count=[1])
channel.basic_consume(queue='task_queue', on_message_callback=callback, auto_ack=[2])
channel.start_consuming()
Drag options to blanks, or click blank then click option'
A1
B0
CFalse
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using auto_ack=True causes messages to be acknowledged before processing.