Rocketmq Python Cvs 2.1.0.3 | Coderz Repository

rocketmq-python-cvs 2.1.0.3

Last updated:

0 purchases

rocketmq-python-cvs 2.1.0.3 Image
rocketmq-python-cvs 2.1.0.3 Images

Free

Languages

Categories

Add to Cart

Description:

rocketmqpythoncvs 2.1.0.3

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

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product: (if this is empty don't purchase this product)

Customer Reviews

There are no reviews.