python rabbitmq 初识
来源:互联网 发布:码字赚钱的软件 编辑:程序博客网 时间:2024/04/27 21:36
基于模块pika实现
send.py
#_*_coding:utf-8_*_import pikaimport timeconnection = pika.BlockingConnection(pika.ConnectionParameters("192.168.140.78",5672))channel =connection.channel()channel.queue_declare(queue="hello") #创建一个queuechannel.basic_publish(exchange="",routing_key="hello",body="helloworld!")print("send 'helloworld'")connection.close()#消息发送后关闭,确保缓冲器资料全部被送出(flush)
recieve.py
import pikaconnection =pika.BlockingConnection(pika.ConnectionParameters("192.168.140.78",78))channel = connection.channel()channel.queue_declare(queue="hello")def callback(ch,method,properties,body): print("receive")channel.basic_consume(callback,queue="hello",no_ack=True)channel.start_consuming()
0 0
- python rabbitmq 初识
- RabbitMQ初识
- RabbitMQ初识
- 初识rabbitmq
- 初识RabbitMQ
- Python rabbitmq
- python-rabbitmq
- rabbitMQ-python
- 初识RabbitMQ,附RabbitMQ+PHP演示实例
- 初识python
- 初识Python
- 初识python
- 初识PYTHON
- 初识Python
- 初识Python
- 初识Python
- Python -- 初识
- 初识Python
- Android 热修复原理
- Chapter 9<C++ Primer Plus>
- Unity 使用Linq解析Excel
- UGUI中ScrollView的使用及注意事项
- 百度面试
- python rabbitmq 初识
- 方差分析 可汗学院统计学 笔记
- Kryo序列化和ProroStruff序列化性能比较
- ubuntu14.04中thunderbird延迟发送邮件
- python学习入门
- sql2005 打开表时提示未将对象引用设置到对象实例问题
- Atitit.自然语言处理--摘要算法---圣经章节旧约39卷概览bible overview v2 qa1.docx
- 基于python 3 的selenium模块实现网页自动登陆
- Java Web获取数据库数据,利用jxl实现数据导出成Excel文件