rocketmq-all-4.5.0-bin-release
2、启动:先启动mqnamesrv.cmd ,再启动mqbroker.cmdmqnamesrv.cmd
mqbroker.cmd -n localhost:9876 autoCreateTopicEnable=true3、demo
user-service作为生产者
3.1 导入依赖3.2 配置org.apache.rocketmq rocketmq-spring-boot-starter 2.2.1
rockemq: name-service : 127.0.0.1:9876 producer: #表示当前producer所属哪个生产者的组 group : jack-producer3.3 生产消息
@Resource
RocketMQTemplate rocketMQTemplate;
@PostMapping("/produce")
public void produce(){
this.rocketMQTemplate.convertAndSend("jack-topic","hello jack");
}
4、dashboard
rocketmq-externals-master
rocketmq-console组件里面修改配置文件
server.address=0.0.0.0
server.port=18080 # dashboard监听在哪个端口
### SSL setting
#server.ssl.key-store=classpath:rmqcngkeystore.jks
#server.ssl.key-store-password=rocketmq
#server.ssl.keyStoreType=PKCS12
#server.ssl.keyAlias=rmqcngkey
#spring.application.index=true
spring.application.name=rocketmq-console
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
logging.level.root=INFO
logging.config=classpath:logback.xml
#if this value is empty,use env value rocketmq.config.namesrvAddr NAMESRV_ADDR | now, you can set it in ops page.default localhost:9876
# 需要连接到哪个rocketmq-server ,监测数据
rocketmq.config.namesrvAddr=127.0.0.1:9876
#if you use rocketmq version < 3.5.8, rocketmq.config.isVIPChannel should be false.default true
rocketmq.config.isVIPChannel=
#rocketmq-console's data path:dashboard/monitor
rocketmq.config.dataPath=/tmp/rocketmq-console/data
#set it false if you don't want use dashboard.default true
rocketmq.config.enableDashBoardCollect=true
#set the message track trace topic if you don't want use the default one
rocketmq.config.msgTrackTopicName=
rocketmq.config.ticketKey=ticket
#Must create userInfo file: ${rocketmq.config.dataPath}/users.properties if the login is required
rocketmq.config.loginRequired=false
#set the accessKey and secretKey if you used acl
#rocketmq.config.accessKey=
#rocketmq.config.secretKey=
4.1 生成jar
rocketmq-console-ng-2.0.0.jar4.2 访问localhost:18080 5、order-service作为消费者 5.1 导入依赖
5.2 配置org.apache.rocketmq rocketmq-spring-boot-starter2.2.1
rocketmq: name-server: 127.0.0.1:98765.3 新建一个consumer
@Service @RocketMQMessageListener(consumerGroup = "jack-producer",topic = "jack-topic") public class ConsumerListener implements RocketMQReplyListener{ @Override public Object onMessage(String s) { System.out.println("获取到生产者的消息"+s); return null; }



