RocketMQ Python Client CVS
Project description
rocketmq-python-cvs
RocketMQ Python client, based on rocketmq-client-cpp, supports Linux and macOS
use librocketmq.so custom
Installation
pip install rocketmq-python-cvs
Usage
Producer
from rocketmq.client import Producer, Message
producer = Producer('PID-XXX')
producer.set_log_root_path('/opt/app/karl_demo')
producer.set_name_server_address('127.0.0.1:9876')
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_log_root_path('/opt/app/karl_demo')
consumer.set_name_server_address('127.0.0.1:9876')
consumer.subscribe('YOUR-TOPIC', callback)
consumer.start()
while True:
time.sleep(3600)
consumer.shutdown()
License
Apache License, Version 2.0 Copyright (C) Apache Software Foundation
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
File details
Details for the file rocketmq-python-cvs-2.1.0.3.tar.gz
.
File metadata
- Download URL: rocketmq-python-cvs-2.1.0.3.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99e4ce8008554a74193a3ad94b60f939a4666c48ffabbf4c4417a109daf1419d |
|
MD5 | 635081eed9c15d442c1f0f441e1356e5 |
|
BLAKE2b-256 | c8195a8d8a5a259f7cbecc34407ed4f6707858438806c9307bc96e7a8db93b13 |