rocketmq-client-python
rocketmq-client-python copied to clipboard
Producer 生产消息到只能发送到topic的queue 0 内?
当前topic 有16个queue ,但是所有的消息只能发送到queue0内? 按照rocketmq的默认策略应该是会进行轮询queueu,使用的发送方式是同步发送 ,java客户端正常,所有排除rocketmq集群问题,请问如何才能将消息发送到多个queue内呢?
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()
我也遇到了这个问题,大概90%的流量都在一个queue, 其他10%的流量分布在其余若干个queue,请问你解决了吗?