Complete the code to declare a headers exchange named 'logs_headers'.
channel.exchange_declare(exchange='logs_headers', exchange_type='[1]')
The exchange type for headers exchange is headers.
Complete the code to bind a queue named 'error_logs' to the headers exchange with header 'x-match' set to 'all'.
channel.queue_bind(queue='error_logs', exchange='logs_headers', arguments=[1])
Binding with 'x-match': 'all' means all headers must match. Here, we want severity 'error'.
Fix the error in the code to publish a message with headers 'severity' set to 'error' and 'format' set to 'pdf'.
channel.basic_publish(exchange='logs_headers', routing_key='', body='Error report', properties=pika.BasicProperties(headers=[1]))
Headers must be a dictionary. Option D correctly uses a dict with keys and values.
Fill both blanks to declare a headers exchange and bind a queue with 'x-match' set to 'any'.
channel.exchange_declare(exchange='logs_headers', exchange_type='[1]') channel.queue_bind(queue='info_logs', exchange='logs_headers', arguments=[2])
The exchange type must be 'headers'. The binding uses 'x-match' set to 'any' to match any header.
Fill all three blanks to publish a message with headers and bind a queue with matching headers.
channel.basic_publish(exchange='logs_headers', routing_key='', body='Info report', properties=pika.BasicProperties(headers=[1])) channel.queue_bind(queue='info_logs', exchange='logs_headers', arguments=[2]) channel.exchange_declare(exchange='logs_headers', exchange_type='[3]')
Publish headers must match binding headers. Exchange type is 'headers'.