0
0
RabbitMQdevops~10 mins

Why RabbitMQ is the most popular message broker - Test Your Understanding

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

Complete the code to start the RabbitMQ server using the correct command.

RabbitMQ
sudo systemctl [1] rabbitmq-server
Drag options to blanks, or click blank then click option'
Astop
Brestart
Cstart
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'stop' instead of 'start' will turn off the service.
Using 'status' only shows the current state but does not start the service.
2fill in blank
medium

Complete the code to declare a queue named 'task_queue' in RabbitMQ using the correct method.

RabbitMQ
channel.queue_[1]('task_queue', durable=True)
Drag options to blanks, or click blank then click option'
Adeclare
Bdelete
Cbind
Dconsume
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'delete' removes the queue instead of creating it.
Using 'consume' is for receiving messages, not declaring queues.
3fill in blank
hard

Fix the error in the code to publish a message to the 'task_queue' with persistence.

RabbitMQ
channel.basic_publish(exchange='', routing_key='task_queue', body='Hello World!', properties=[1])
Drag options to blanks, or click blank then click option'
Apika.BasicProperties(expiration='60000')
Bpika.BasicProperties(delivery_mode=1)
Cpika.BasicProperties(priority=2)
Dpika.BasicProperties(delivery_mode=2)
Attempts:
3 left
💡 Hint
Common Mistakes
Using delivery_mode=1 sends non-persistent messages that can be lost.
Using priority or expiration does not ensure message persistence.
4fill in blank
hard

Fill both blanks to create a durable queue and ensure messages are persistent.

RabbitMQ
channel.queue_declare(queue='task_queue', [1]=True)
channel.basic_publish(exchange='', routing_key='task_queue', body='Work', properties=[2])
Drag options to blanks, or click blank then click option'
Adurable
Bpika.BasicProperties(delivery_mode=2)
Cpika.BasicProperties(delivery_mode=1)
Dexclusive
Attempts:
3 left
💡 Hint
Common Mistakes
Using exclusive instead of durable makes the queue only accessible by one connection.
Using delivery_mode=1 sends non-persistent messages.
5fill in blank
hard

Fill all three blanks to consume messages from 'task_queue' with manual acknowledgement.

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=[3], auto_ack=False)
channel.start_consuming()
Drag options to blanks, or click blank then click option'
Amethod.delivery_tag
B'task_queue'
Ccallback
D'task'
Attempts:
3 left
💡 Hint
Common Mistakes
Using auto_ack=True disables manual acknowledgement.
Using wrong queue name causes no messages to be consumed.