python active 下载安装测试
来源:互联网 发布:js设置标签属性值 编辑:程序博客网 时间:2024/05/21 19:43
软件版本:
apache-activemq-5.7.0-bin.tar.gz
stomp.py-3.1.1.tar.gz
下载地址:
http://activemq.apache.org/download.html
http://code.google.com/p/stomppy/downloads/list
(http://code.google.com/p/stomppy/downloads/detail?name=stomp.py-3.1.1.tar.gz&can=1&q=)
activemq安装:
tar -zxvf apache-activemq-5.7.0-bin.tar.gz
mv apache-activemq-5.7.0 /usr/local/activemq/
改配置:
vi /usr/local/activemq/conf/activemq.xml
chmod -R 777 /usr/local/activemq/
添加一句
<transportConnectors> <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireformat.maxFrameSize=104857600"/> <transportConnector name="stomp+nio" uri="stomp+nio://0.0.0.0:61613"/></transportConnectors>
启动服务:
/usr/local/activemq/bin/activemq start
检查:
[root@localhost pythontest]# netstat -an | grep 61616
tcp 0 0 :::61616 :::* LISTEN
[root@localhost pythontest]# netstat -an | grep 61613
tcp 0 0 :::61613 :::* LISTEN
http://192.168.10.62:8161/admin
stomp安装:
tar -zxvf stomp.py-3.1.1.tar.gz
cd stomp.py-3.1.1
python setup.py install --prefix=/usr/local/python27 (python安装目录)
完成。
python demo
以下转自:http://blog.csdn.net/xiarendeniao/article/details/7053958#comments
#!/usr/bin/python## Usage: stomp_send.py <msize> <nmsgs>#import sysimport osimport loggingimport stompimport timeimport jsonlogging.basicConfig()nmsgs = int(sys.argv[1])msg = {'pid':1,'id':1,'start_at':"time",'type':'parse_title','articleid':0, 'from':1, 'to':361}dest = '/queue/test1'start = time.time()conn = stomp.Connection([('192.168.42.38', 61613)])conn.start()conn.connect(wait=True)for i in range(nmsgs):msg['articleid'] = iconn.send(json.write(msg), destination=dest)print "send one"conn.disconnect()print "OK Finished msgs %d time %f" % (nmsgs, (time.time()-start))
mq_rective.py
import sysimport osimport loggingimport stompimport jsonimport timeclass MyListener(object):def on_error(self, headers, message):print 'received an error %s' % messagedef on_message(self, headers, message):print 'received a message %s' % message#print headers['message-id']#sys.exit(0)conn.ack({'message-id':headers['message-id']})dest = '/queue/test1'logging.basicConfig()conn = stomp.Connection([('192.168.42.38', 61613)])conn.set_listener('', MyListener())conn.start()conn.connect(wait=True)conn.subscribe(destination=dest, ack='client')while True:try:time.sleep(1)except:break
运行:
[root@localhost pythontest]# python mq_send.py 4
send one
send one
send one
send one
OK Finished msgs 4 time 0.015546
[root@localhost pythontest]#
[root@localhost pythontest]# python mq_receive.py
received a message {"start_at": "time", "pid": 1, "to": 361, "articleid": 0, "from": 1, "type": "parse_title", "id": 1}
received a message {"start_at": "time", "pid": 1, "to": 361, "articleid": 1, "from": 1, "type": "parse_title", "id": 1}
received a message {"start_at": "time", "pid": 1, "to": 361, "articleid": 2, "from": 1, "type": "parse_title", "id": 1}
received a message {"start_at": "time", "pid": 1, "to": 361, "articleid": 3, "from": 1, "type": "parse_title", "id": 1}
- python active 下载安装测试
- 消息队列 -- active mq 安装测试
- Python搭建Numpy、SciPy、MatPlotLib环境(下载、安装、测试)
- Python 3.6.3 官网 下载 安装 测试 入门教程 (windows)
- CUnit 下载、安装、测试
- 下载和安装Python
- python下载与安装
- python模块下载安装
- 下载和安装python
- python下载安装
- python安装及下载
- python下载和安装
- 下载和安装python
- python 下载安装教程
- python requests 下载安装
- python下载及安装
- python-BeautifulSoup下载安装
- Python下载安装
- 有关STL的用法及区别
- Flex学习——打印
- 非阻塞 socket整理
- 三步学会Java Socket编程(三)
- 用GCC 4.8.1 编译CppCMS
- python active 下载安装测试
- Windows 8 Metro App 无法联网问题-代理问题
- ASP.NET使用Newtonsoft.Json反解析带子集的JSON字符串
- 数据结构排序系列详解之八 堆排序
- Mysql存储过程(一)——原子性
- uva 113 - Power of Cryptography
- Structs的基本配置入门
- c#实现简体字/繁体字的与转
- 判断地址url是以http://开头的