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.11.tar.gz
(1.2 MB
view details)
Built Distributions
File details
Details for the file rocketmq-0.3.11.tar.gz
.
File metadata
- Download URL: rocketmq-0.3.11.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/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cae8ce3cdd378c7ba71c10455cea90e7d6d4546025eb2ae67d6fe9bb861e208e |
|
MD5 | 725cbd683be9912e948c6543ec2acc9c |
|
BLAKE2b-256 | 817427543d5a908e5494e6475b2b9099628342e58168ca94014236ae4c6fa78a |
File details
Details for the file rocketmq-0.3.11-py2.py3-none-manylinux1_x86_64.whl
.
File metadata
- Download URL: rocketmq-0.3.11-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/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 461dd8740fcaff25fd7eb82c905fa7442db3f4caea01e10bece8d87387985b89 |
|
MD5 | 975564d19ce603c0817895940f540a49 |
|
BLAKE2b-256 | 6ac10f2e170ac1600843aa9449bb74a65cf83a7fbbc5baa0580d413a04740929 |
File details
Details for the file rocketmq-0.3.11-py2.py3-none-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: rocketmq-0.3.11-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 | 9c6aa06ef29db36c464caeb73feebc6239d58fd09f8e5fb8051775df6bb9456b |
|
MD5 | 39fe2d46c3b66e720b337cd0d17cc1d7 |
|
BLAKE2b-256 | 5cc169b361099e6acfea24ff1131a5b961a54fd46febcb52f91c94cd156ba703 |