Complete the code to declare a durable queue in RabbitMQ.
channel.queue_declare(queue='task_queue', durable=[1])
Setting durable=True ensures the queue survives RabbitMQ restarts, protecting message integrity.
Complete the code to publish a persistent message to the queue.
channel.basic_publish(exchange='', routing_key='task_queue', body=message, properties=pika.BasicProperties(delivery_mode=[1]))
Setting delivery_mode=2 marks the message as persistent, so it is saved to disk.
Fix the error in the code to enable publisher confirms for message integrity.
channel.[1]()The method confirm_select() enables publisher confirms, allowing the publisher to know if messages are received.
Fill both blanks to set up a secure connection with TLS and verify the server certificate.
parameters = pika.ConnectionParameters(host='rabbitmq.example.com', ssl_options=[1](ca_certs='ca.pem', cert_reqs=[2]))
Use pika.SSLOptions to configure TLS and ssl.CERT_REQUIRED to enforce server certificate verification, protecting message integrity.
Fill all three blanks to create a dictionary comprehension that filters messages with priority above 5 and marks them as urgent.
urgent_messages = [1]: {'priority': [2], 'urgent': [3] for [1], [2] in messages.items() if [2] > 5
This comprehension creates a new dictionary with message IDs as keys, priority values, and marks messages as urgent if priority is above 5.