RocketMQ Python client
Project description
rocketmq-python
RocketMQ Python client
Installation
pip install rocketmq
Usage
Producer
from rocketmq.client import Producer, Message
producer = Producer('PID-XXX')
producer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')
producer.set_session_credentials('XXX', 'XXXX', '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
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')
consumer.set_session_credentials('XXX', 'XXXX', 'ALIYUN')
consumer.subscribe('YOUR-TOPIC', callback)
consumer.start()
while True:
time.sleep(3600)
consumer.shutdown()
PullConsumer
from rocketmq.client import PullConsumer
consumer = PullConsumer('CID_XXX')
consumer.set_namesrv_domain('http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet')
consumer.set_session_credentials('XXX', 'XXXX', '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 file.
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
rocketmq-0.3.14.tar.gz
(1.2 MB
view details)
Built Distributions
File details
Details for the file rocketmq-0.3.14.tar.gz
.
File metadata
- Download URL: rocketmq-0.3.14.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 299f815516cf5008ad04f917c3f919fd98d9c707e0b13de41068ec56b983012b |
|
MD5 | 072d4e774def721d426a58188e37c9a6 |
|
BLAKE2b-256 | 9a9bca823d89842a03aad05beeac149f93c4b3b846c64f4053df2cf5f5749105 |
File details
Details for the file rocketmq-0.3.14-py2.py3-none-manylinux1_x86_64.whl
.
File metadata
- Download URL: rocketmq-0.3.14-py2.py3-none-manylinux1_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b85381bc02a3954b26b4f0d9ef23ce9a2f9fc3a96c9c4a966fb4e9e29dcc71f6 |
|
MD5 | ebc738c446d85878837d589a6a261995 |
|
BLAKE2b-256 | 96b5dd9c5b04cbddcc4995c68afed492840421ec47c63f2aadfcb4ac6122ff99 |
File details
Details for the file rocketmq-0.3.14-py2.py3-none-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: rocketmq-0.3.14-py2.py3-none-macosx_10_13_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 2, Python 3, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84a0c5988a97c49952d38117597d40cc29745794f7d9dc82442ed75b7d860df6 |
|
MD5 | 5fc594759fe85ad64fad2d8be738a485 |
|
BLAKE2b-256 | 2978f962d7fb6992510ff7c04e842c24ab6d68e5cae52521a8a9588fec1e57a9 |