miner-k commented on issue #128:
URL:
https://github.com/apache/rocketmq-client-python/issues/128#issuecomment-1458127111
from rocketmq.client import Producer, Message
# 创建消费者,指定groupid的名称
producer = Producer('PID-python')
# 设置nameserver的地址
producer.set_namesrv_addr('172.16.154.100:9876')
# 启动生产者
producer.start()
for i in range(100):
# 创建消息,指定topic
msg = Message('test-topic4')
msg.set_keys('t_key')
msg.set_tags('t_tag')
msg.set_body('t_body_' + str(i))
ret = producer.send_sync(msg)
print(ret.status, ret.msg_id, ret.offset)
# 关闭生产者
producer.shutdown()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]