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
rocketmq-python-cvs-2.1.0.tar.gz
(11.2 kB
view hashes)
Close
Hashes for rocketmq-python-cvs-2.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0e394ec649ed6aa95dd657fff91293a2a2d3e69f6ee24f0e16400556af778db |
|
MD5 | 578ec773d361a29c49555adffdefeccc |
|
BLAKE2b-256 | 41a8c966f5ee68af72d9d2f3a0949026c6a3dae2450eaf5c78973a39e713e179 |