RocketMQ Python Client wise lib
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
rocketmq_wise-2.0.1.tar.gz
(14.4 kB
view details)
File details
Details for the file rocketmq_wise-2.0.1.tar.gz.
File metadata
- Download URL: rocketmq_wise-2.0.1.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06a1e1b96e04b00438420bccda5324a35e9230690a38c6da353d3892a96bee7d
|
|
| MD5 |
45e4a859e7d9b3625dab6f15818fe31b
|
|
| BLAKE2b-256 |
ba99f5928e84ef6dee42e2f7d3a3a6ba0e02c2878c43ee4102371db68a65407b
|