mq的python封装包
Project description
Message Queue Client for Python
生成安装包
参考 https://packaging.python.org/tutorials/packaging-projects/
- 升级安装必要工具
python3 -m pip install --upgrade build
python3 -m pip install --user --upgrade twine
- 生成安装包
python3 -m build
- 上传安装包
python3 -m twine upload --repository-url https://<私有镜像地址> dist/*
默认上传到 https://pypi.org
python3 -m twine upload dist/*
使用安装包
- install
pip3 install xmq-python
- 发送消息
from xmq_python.producer import Producer
producer = Producer(mq_type='AMQO', host='', port=0, access_key='', access_secret='', timeout=None, max_message_size=None, username='', password='', virtual_host='', instance_id='')
producer.start()
producer.Publish('order','demand',{"id":123, "name": "neil"})
producer.stop()
- 接收消息
from xmq_python.comsumer import Comsumer
import time
def callback(message):
print("Got message: ", message)
return True
comsumer = Comsumer(mq_type='AMQO', comsumer_group_name='', host='', port=0, access_key='', access_secret='', timeout=None, max_message_size='', username='', password='', virtual_host='', instance_id='')
comsumer.Register("order","demand",callback)
comsumer.start()
time.sleep(100)
comsumer.stop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xmq-python-0.0.6.tar.gz
(7.0 kB
view hashes)
Built Distribution
xmq_python-0.0.6-py3-none-any.whl
(17.5 kB
view hashes)
Close
Hashes for xmq_python-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9eec9558505a3d665a64bfa7c00c693630a7e114be67e364261aac584aab0957 |
|
MD5 | 9d6852b7a9ede904338325da12fa659c |
|
BLAKE2b-256 | 1028d79986dbaa5c8fe8bb1f0e65c5b791edee8b438a50cccf4778825947aabb |