Complete the code to declare a queue in RabbitMQ.
channel.queue_declare(queue=[1])The queue name must be a string enclosed in quotes.
Complete the code to publish a message to a queue.
channel.basic_publish(exchange='', routing_key=[1], body=message)
The routing_key should be the queue name as a string.
Fix the error in the consumer callback function to acknowledge message receipt.
def callback(ch, method, properties, body): print(f"Received {body}") ch.basic_ack(delivery_tag=[1])
The delivery_tag is accessed from the method parameter to acknowledge the message.
Fill both blanks to create a durable queue and persistent message.
channel.queue_declare(queue='task_queue', durable=[1]) channel.basic_publish(exchange='', routing_key='task_queue', body=message, properties=[2])
Durable queues survive server restarts and persistent messages are marked with delivery_mode=2.
Fill all three blanks to set up a fanout exchange and bind a queue to it.
channel.exchange_declare(exchange=[1], exchange_type=[2]) channel.queue_bind(exchange=[3], queue='logs')
The exchange is named 'logs_exchange' with type 'fanout'. The queue is bound to the same exchange.
