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_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_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
Built Distributions
Close
Hashes for rocketmq-client-python-0.5.0rc5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a35dbba262e81313acb91289a8fa3c47372fbf55f182d96ca7a039c977f332c |
|
MD5 | cc9f34ea88d4a4d4ccbbb4806a4c23fb |
|
BLAKE2b-256 | 29b6cff224f3c8dcc3065e579e24ac2928f8c108efbbefd966d07f6c4592faf9 |
Close
Hashes for rocketmq_client_python-0.5.0rc5-py2.py3-none-macosx_10_14_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 610ee0b4fef40c16e6933ed3caa364b3aa2946203c34b88447fb39218c5f12a8 |
|
MD5 | d2771c70629db97b891efb0fe02ea145 |
|
BLAKE2b-256 | cf766e90141b88630f7a9a94ddf96a80a9729f474f1519d5f91da35b1b76b1eb |
Close
Hashes for rocketmq_client_python-0.5.0rc5-py2.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84e01b6576db7790764bfa9ee874662349cde56282cdd9d4466d41db69c8a3b6 |
|
MD5 | 92bf55596e0ade2d32df5d2804a8731a |
|
BLAKE2b-256 | 248a25817cb5bd1a114bc5914e52981bd4750ec7f1486287af486c3c5b63cde9 |