Complete the code to start the RabbitMQ server using the correct command.
sudo systemctl [1] rabbitmq-serverThe command sudo systemctl start rabbitmq-server starts the RabbitMQ service on your system.
Complete the code to declare a queue named 'task_queue' in RabbitMQ using the correct method.
channel.queue_[1]('task_queue', durable=True)
The method queue_declare is used to create or check a queue in RabbitMQ.
Fix the error in the code to publish a message to the 'task_queue' with persistence.
channel.basic_publish(exchange='', routing_key='task_queue', body='Hello World!', properties=[1])
Setting delivery_mode=2 makes the message persistent, so it is saved to disk.
Fill both blanks to create a durable queue and ensure messages are persistent.
channel.queue_declare(queue='task_queue', [1]=True) channel.basic_publish(exchange='', routing_key='task_queue', body='Work', properties=[2])
Setting durable=True makes the queue survive server restarts, and delivery_mode=2 makes messages persistent.
Fill all three blanks to consume messages from 'task_queue' with manual acknowledgement.
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()
The delivery_tag is used to acknowledge the message manually. The queue name is 'task_queue', and the callback function is named 'callback'.