#测试RabbitMQ消息永久化 # #. Sub-queue persistence and Information permanence # #. This means that when the service restarts, the queues and messages are still present and can be accepted by the client. View Message Queuing commands on the server./rabbitmqctl list_queues#send Port Import pikacredentials = Pika. Plaincredentials (' root ', ' Password1 ') connection = Pika. Blockingconnection (Pika. Connectionparameters (' 10.3.151.86 ', 5672, '/', credentials)) channel = Connection.channel () channel.queue_declare ( Queue= ' Hello3 ', durable=true) #durable =true declares a queue to be persisted (after service restart) channel.basic_publish (exchange= ", routing_key= ' hell O3 ', body= ' Hello wfffforld! ', Properties=pika. Basicproperties (delivery_mode=2)) #properties =pika. Basicproperties (delivery_mode=2) to perpetuate the message (after the service restarts) Connection.close ()
This article is from the "Learning Journey" blog, so be sure to keep this source http://mingkang.blog.51cto.com/9678221/1976128
Fifth: Python RABBITMQ message Persistence