Complete the code to declare a topic exchange named 'logs'.
channel.exchange_declare(exchange='[1]', exchange_type='topic')
The exchange name is 'logs' as declared in the code.
Complete the code to bind the queue 'error_logs' to the exchange 'logs' with routing key 'error'.
channel.queue_bind(queue='error_logs', exchange='logs', routing_key='[1]')
The routing key 'error' binds the queue to receive error messages.
Fix the error in the code to publish a message with routing key 'info' to the exchange 'logs'.
channel.basic_publish(exchange='logs', routing_key='[1]', body='System started')
The routing key must match the intended message type, here 'info'.
Fill both blanks to create a binding where the queue 'all_logs' receives all messages regardless of routing key.
channel.queue_bind(queue='all_logs', exchange='logs', routing_key='[1]') channel.basic_publish(exchange='logs', routing_key='[2]', body='Test message')
The routing key '#' matches all routing keys, so the queue receives all messages.
Fill all three blanks to create a topic exchange 'topic_logs', bind queue 'kern_logs' to routing key 'kern.*', and publish a message with routing key 'kern.critical'.
channel.exchange_declare(exchange='[1]', exchange_type='topic') channel.queue_bind(queue='kern_logs', exchange='topic_logs', routing_key='[2]') channel.basic_publish(exchange='topic_logs', routing_key='[3]', body='Kernel critical error')
The exchange is 'topic_logs' of type 'topic'. The queue binds to 'kern.*' to receive all kernel messages. The message is published with routing key 'kern.critical'.