Complete the code to declare a queue named 'task_queue' in RabbitMQ.
channel.queue_declare(queue=[1])The queue name must be a string, so it needs quotes around it.
Complete the code to publish a message 'Hello' to the 'task_queue'.
channel.basic_publish(exchange='', routing_key=[1], body='Hello')
The routing_key should match the queue name to send the message correctly.
Fix the error in the consumer callback function to acknowledge the message.
def callback(ch, method, properties, body): print(f"Received {body}") ch.basic_ack(delivery_tag=[1])
The delivery_tag is part of the method parameter and is needed to acknowledge the message.
Fill both blanks to create a synchronous RPC style call using RabbitMQ.
channel.basic_publish(exchange='', routing_key=[1], properties=[2], body='Request')
In RPC, the routing_key is the RPC queue, and properties must include reply_to with the response queue.
Fill all three blanks to create an asynchronous consumer that listens to 'task_queue' and auto-acknowledges messages.
channel.basic_consume(queue=[1], on_message_callback=[2], auto_ack=[3]) channel.start_consuming()
The consumer listens to 'task_queue', uses the callback function, and auto_ack=True to acknowledge automatically.