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(producer_group_id='BOH', lookup_address='rocketmq-ns.infra:9876')
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(comsumer_group_id='BOH', lookup_address='rocketmq-ns.infra:9876')
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.3.tar.gz
(7.0 kB
view hashes)
Built Distribution
xmq_python-0.0.3-py3-none-any.whl
(17.6 kB
view hashes)
Close
Hashes for xmq_python-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de36f0df8a17807173a3a379883188bb2ef1edd0cf1d254cb89ef67c54f8a1a2 |
|
MD5 | d296340cb1d221430b31ad45d0475389 |
|
BLAKE2b-256 | 5f32d11b94c1b5e48072e80548b0ce7b5a3e31a0e161be8683915ccf94252cb9 |