0
0
RabbitMQdevops~10 mins

What is a message queue in RabbitMQ - Interactive Quiz & 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 in RabbitMQ.

RabbitMQ
channel.queue_declare(queue='[1]')
Drag options to blanks, or click blank then click option'
Aexchange
Btask_queue
Crouting_key
Dconnection
Attempts:
3 left
💡 Hint
Common Mistakes
Using exchange or routing_key instead of queue name.
2fill in blank
medium

Complete the code to send a message to the queue.

RabbitMQ
channel.basic_publish(exchange='', routing_key='[1]', body='Hello World!')
Drag options to blanks, or click blank then click option'
Aexchange
Bchannel
Cconnection
Dtask_queue
Attempts:
3 left
💡 Hint
Common Mistakes
Using exchange name instead of routing_key.
3fill in blank
hard

Fix the error in the code to consume messages from the queue.

RabbitMQ
channel.basic_consume(queue='[1]', on_message_callback=callback, auto_ack=True)
Drag options to blanks, or click blank then click option'
Aexchange
Bconnection
Ctask_queue
Dchannel
Attempts:
3 left
💡 Hint
Common Mistakes
Using exchange or connection instead of queue name.
4fill in blank
hard

Fill both blanks to create a durable queue and send a persistent message.

RabbitMQ
channel.queue_declare(queue='[1]', durable=[2])
channel.basic_publish(exchange='', routing_key='task_queue', body='Important', properties=pika.BasicProperties(delivery_mode=2))
Drag options to blanks, or click blank then click option'
Atask_queue
BTrue
CFalse
Dlogs
Attempts:
3 left
💡 Hint
Common Mistakes
Using False for durable or wrong queue name.
5fill in blank
hard

Fill all three blanks to set up a consumer with manual message acknowledgment.

RabbitMQ
def callback(ch, method, properties, body):
    print(f"Received {body}")
    ch.basic_ack(delivery_tag=[1])

channel.basic_consume(queue=[2], on_message_callback=callback, auto_ack=[3])
Drag options to blanks, or click blank then click option'
Amethod.delivery_tag
B'task_queue'
CFalse
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using auto_ack=True disables manual ack.
Wrong queue name or missing delivery_tag.