pika是RabbitMQ团队编写的官方Python AMQP库。
需要先安装pika:
pip3 install pika
有较详细的注释,就不再详细说明了
生产者代码:
hello_world_producer.py:
import pika,sys #connect to the rabbitmq,use the default vhost credentials = pika.PlainCredentials("guest","guest") conn_params = pika.ConnectionParameters("localhost",