RocketMQ Python Client
Project description
rocketmq-client-python
RocketMQ Python client, based on rocketmq-client-cpp, supports Linux and macOS
Installation
pip install rocketmq-client-python
Usage
Producer
from rocketmq.client import Producer, Message
producer = Producer('PID-XXX')
producer.set_namesrv_addr('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_namesrv_addr('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
Built Distribution
Close
Hashes for rocketmq-client-python-0.5.0rc3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f3efd97d995bbf1c1c500d87ba41d07034fea70dcefa8d4c9bfaf31da159f22 |
|
MD5 | f9475fa2c180e09e9e8eb7f354464f6c |
|
BLAKE2b-256 | 73bce0370ece7ecce35793692813ae4b7839c751f38a50db4f408d2304007eb5 |
Close
Hashes for rocketmq_client_python-0.5.0rc3-py2.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 873ff301437c4ed33c0127426b51d627e9299e41bb4cf94624e1fa397b7283a1 |
|
MD5 | d598f02ce5dfee0d9166d5d982846097 |
|
BLAKE2b-256 | c813069dea8b0bd9dc4989ef8e75fb3e7170d1cd6d4d8c4f9d3b46dcdbbc2bb3 |