用python的pika包尝尝rabbitmq
<rabbitmq实践>,讲得比较细, 我也用python实打了一下, 以后再用celery时,理解会更深入。 hello_world_producer.py #coding=utf-8 import pika, sys #建立到代理服务器的连接 credentials = pika.PlainCredentials("guest", "guest") conn_params = pika.ConnectionParameters("localhost", credentials=credentials) conn_broker = pika.BlockingConnection(conn_params) #获得信道 channel = conn_broker.channel() #声明交换器 channel.exchange_declare(exchange="hello-exchange", exchange_type="direct", passive=False, durable=True, auto_delete=False) #从命令行获取纯文本消息 msg =...