Name | rocketmq JSON |
Version |
0.4.4
JSON |
| download |
home_page | |
Summary | RocketMQ Python client |
upload_time | 2019-11-22 10:48:35 |
maintainer | |
docs_url | None |
author | messense |
requires_python | |
license | |
keywords |
rocketmq
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# rocketmq-python
[![Build Status](https://travis-ci.com/messense/rocketmq-python.svg?branch=master)](https://travis-ci.com/messense/rocketmq-python)
[![codecov](https://codecov.io/gh/messense/rocketmq-python/branch/master/graph/badge.svg)](https://codecov.io/gh/messense/rocketmq-python)
[![PyPI](https://img.shields.io/pypi/v/rocketmq.svg)](https://pypi.org/project/rocketmq)
RocketMQ Python client, based on [rocketmq-client-cpp](https://github.com/apache/rocketmq-client-cpp), supports Linux and macOS
**This project is currently being upstreamed to [apache/rocketmq-client-python](https://github.com/apache/rocketmq-client-python/tree/ctypes)**
## Installation
```bash
pip install rocketmq
```
## Usage
### Producer
```python
from rocketmq.client import Producer, Message
producer = Producer('PID-XXX')
producer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')
# For ip and port name server address, use `set_namesrv_addr` method, for example:
# producer.set_namesrv_addr('127.0.0.1:9887')
producer.set_session_credentials('XXX', 'XXXX', 'ALIYUN') # No need to call this function if you don't use Aliyun.
producer.start()
msg = Message('YOUR-TOPIC')
msg.set_keys('XXX')
msg.set_tags('XXX')
msg.set_body('XXXX')
ret = producer.send_sync(msg)
print(ret.status, ret.msg_id, ret.offset)
producer.shutdown()
```
### PushConsumer
```python
import time
from rocketmq.client import PushConsumer
def callback(msg):
print(msg.id, msg.body)
consumer = PushConsumer('CID_XXX')
consumer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')
# For ip and port name server address, use `set_namesrv_addr` method, for example:
# consumer.set_namesrv_addr('127.0.0.1:9887')
consumer.set_session_credentials('XXX', 'XXXX', 'ALIYUN') # No need to call this function if you don't use Aliyun.
consumer.subscribe('YOUR-TOPIC', callback)
consumer.start()
while True:
time.sleep(3600)
consumer.shutdown()
```
### PullConsumer
```python
from rocketmq.client import PullConsumer
consumer = PullConsumer('CID_XXX')
consumer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')
# For ip and port name server address, use `set_namesrv_addr` method, for example:
# consumer.set_namesrv_addr('127.0.0.1:9887')
consumer.set_session_credentials('XXX', 'XXXX', 'ALIYUN') # No need to call this function if you don't use Aliyun.
consumer.start()
for msg in consumer.pull('YOUR-TOPIC'):
print(msg.id, msg.body)
consumer.shutdown()
```
## License
This work is released under the MIT license. A copy of the license is provided in the [LICENSE](./LICENSE) file.
Raw data
{
"_id": null,
"home_page": "",
"name": "rocketmq",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "rocketmq",
"author": "messense",
"author_email": "messense@icloud.com",
"download_url": "https://files.pythonhosted.org/packages/16/6e/dbbe798f0747a8689693b02001af2cb83cf338fdb58e0d3e9563c21026a0/rocketmq-0.4.4.tar.gz",
"platform": "",
"description": "# rocketmq-python\n\n[![Build Status](https://travis-ci.com/messense/rocketmq-python.svg?branch=master)](https://travis-ci.com/messense/rocketmq-python)\n[![codecov](https://codecov.io/gh/messense/rocketmq-python/branch/master/graph/badge.svg)](https://codecov.io/gh/messense/rocketmq-python)\n[![PyPI](https://img.shields.io/pypi/v/rocketmq.svg)](https://pypi.org/project/rocketmq)\n\nRocketMQ Python client, based on [rocketmq-client-cpp](https://github.com/apache/rocketmq-client-cpp), supports Linux and macOS\n\n**This project is currently being upstreamed to [apache/rocketmq-client-python](https://github.com/apache/rocketmq-client-python/tree/ctypes)**\n\n## Installation\n\n```bash\npip install rocketmq\n```\n\n## Usage\n\n### Producer\n\n```python\nfrom rocketmq.client import Producer, Message\n\nproducer = Producer('PID-XXX')\nproducer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')\n# For ip and port name server address, use `set_namesrv_addr` method, for example:\n# producer.set_namesrv_addr('127.0.0.1:9887')\nproducer.set_session_credentials('XXX', 'XXXX', 'ALIYUN') # No need to call this function if you don't use Aliyun.\nproducer.start()\n\nmsg = Message('YOUR-TOPIC')\nmsg.set_keys('XXX')\nmsg.set_tags('XXX')\nmsg.set_body('XXXX')\nret = producer.send_sync(msg)\nprint(ret.status, ret.msg_id, ret.offset)\nproducer.shutdown()\n```\n\n### PushConsumer\n\n```python\nimport time\n\nfrom rocketmq.client import PushConsumer\n\n\ndef callback(msg):\n print(msg.id, msg.body)\n\n\nconsumer = PushConsumer('CID_XXX')\nconsumer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')\n# For ip and port name server address, use `set_namesrv_addr` method, for example:\n# consumer.set_namesrv_addr('127.0.0.1:9887')\nconsumer.set_session_credentials('XXX', 'XXXX', 'ALIYUN') # No need to call this function if you don't use Aliyun.\nconsumer.subscribe('YOUR-TOPIC', callback)\nconsumer.start()\n\nwhile True:\n time.sleep(3600)\n\nconsumer.shutdown()\n\n```\n\n### PullConsumer\n\n```python\nfrom rocketmq.client import PullConsumer\n\n\nconsumer = PullConsumer('CID_XXX')\nconsumer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')\n# For ip and port name server address, use `set_namesrv_addr` method, for example:\n# consumer.set_namesrv_addr('127.0.0.1:9887')\nconsumer.set_session_credentials('XXX', 'XXXX', 'ALIYUN') # No need to call this function if you don't use Aliyun.\nconsumer.start()\n\nfor msg in consumer.pull('YOUR-TOPIC'):\n print(msg.id, msg.body)\n\nconsumer.shutdown()\n```\n\n## License\n\nThis work is released under the MIT license. A copy of the license is provided in the [LICENSE](./LICENSE) file.\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "RocketMQ Python client",
"version": "0.4.4",
"split_keywords": [
"rocketmq"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "ef7cc42b60ef5704aee5168c69063ca1",
"sha256": "5ec68221dfaaffc386d5331d54d2eeb1d6c63325eb4cea4698e21d3b97310c21"
},
"downloads": -1,
"filename": "rocketmq-0.4.4-py2.py3-none-macosx_10_14_x86_64.whl",
"has_sig": false,
"md5_digest": "ef7cc42b60ef5704aee5168c69063ca1",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 1082824,
"upload_time": "2019-11-22T10:55:25",
"upload_time_iso_8601": "2019-11-22T10:55:25.246744Z",
"url": "https://files.pythonhosted.org/packages/ff/14/9a3e0a587455a85d9301e3d12665113e75ff6c6d32e9500fbe5a41c0ccb9/rocketmq-0.4.4-py2.py3-none-macosx_10_14_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "c841715e32d8641a814984fbf4e1a19e",
"sha256": "19a10219f5074d1050e88cdbdfed3903a374b3f83c0dd2c8773e1e93e33ad02d"
},
"downloads": -1,
"filename": "rocketmq-0.4.4-py2.py3-none-manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "c841715e32d8641a814984fbf4e1a19e",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 1260026,
"upload_time": "2019-11-22T09:47:32",
"upload_time_iso_8601": "2019-11-22T09:47:32.634780Z",
"url": "https://files.pythonhosted.org/packages/e9/ce/d7449cc585e506c06553082f715bdc082b37e8804a64203eacfabc5a197c/rocketmq-0.4.4-py2.py3-none-manylinux1_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "90ae44476bd150b34d96fa09e3cdc1af",
"sha256": "ac10affce56ecfbfac82efe5a22c050c36749365c6c080f22c9d486798d537dc"
},
"downloads": -1,
"filename": "rocketmq-0.4.4.tar.gz",
"has_sig": false,
"md5_digest": "90ae44476bd150b34d96fa09e3cdc1af",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9882,
"upload_time": "2019-11-22T10:48:35",
"upload_time_iso_8601": "2019-11-22T10:48:35.245452Z",
"url": "https://files.pythonhosted.org/packages/16/6e/dbbe798f0747a8689693b02001af2cb83cf338fdb58e0d3e9563c21026a0/rocketmq-0.4.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-11-22 10:48:35",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "rocketmq"
}