下载地址 https://rocketmq.apache.org/download
解压之后,进入bin目录
1:启动mqnamesrv
win: .\mqnamesrv.cmd
linux: mqnamesrv
2:启动broker
win: .\mqbroker.cmd -n 127.0.0.1:9876 autoCreateTopicEnable=true
linux: mqbroker -n 127.0.0.1:9876 autoCreateTopicEnable=true
我的5版本autoCreateTopicEnable=true不能用,只能改配置conf/broker.conf增加
autoCreateTopicEnable=true
3:生产消息,这里会自动生成topic
win: ./mqadmin.cmd sendMessage -n localhost:9876 -t TopicTest -p "xxxx"
linux: mqadmin sendMessage -n localhost:9876 -t TopicTest -p "xxxx"
4:消费者-1,-c 参数指定了要消费的消息数量,-g 参数指定了消费者组的名称。相同的消费者组,认为是同一个订阅
win: .\mqadmin.cmd consumeMessage -n localhost:9876 -t TopicTest -c 1 -g cosumeGroup
linux: mqadmin consumeMessage -n localhost:9876 -t TopicTest -c 1 -g cosumeGroup
标签:TopicTest,单机,win,autoCreateTopicEnable,源码,localhost,linux,9876,rocketMq
From: https://www.cnblogs.com/qcy-blog/p/18464700